Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+5 votes
362 views
in Q2A Core by
Currently when users click my logo it links to /index.php but Id like them to jump back to my blog page - is this possible?

1 Answer

0 votes
by
selected by
 
Best answer

You can override the logo() method in your theme. However, the logo content already comes as a pre-constructed HTML fragment (from qa-include/app/page.php). The logo() method only puts that fragment in a <div> tag, so you need to change the link target with a string replacement, e.g. like this:

public function logo() {
  $this->output(
    '<div class="qa-logo">',
    preg_replace('/href=".*?"/', 'href="https://example.com/"', $this->content['logo']),
    '</div>'
  );  
}

The .*? in the regular expression is a non-greedy match, i.e. it matches only up to the next double quote, not up to the last double quote as .* (without the question mark) would.

by
Awesome thanks that's perfect. also thanks the the info re using *? vs just *
...