Using variables as href in anchor tags (PHP) [closed]

It’s not really a WordPress related question, but it’s a simple one. The tribe_get_event_website_link() function you are using outputs a full link. You can use SimpleXML to extract the href part and then use it later. It’s as simple as this: $website = tribe_get_event_website_link(); $xml = new SimpleXMLElement( $website ); echo ‘<a href=”‘ . $xml[‘href’]. … Read more

WordPress format json in postmeta table

Part 1 – To remove the double quotes/extra characters: Instead of trying regular expressions, since the output is somewhat predictable, I would try the following instead of the getCapitalLetters function: function strip_cruft( $str ) { $str = str_replace( ‘”;s’, ”, $str ); $str = str_replace( ‘”‘, ”, $str ); return $str; } Part 2 – … Read more

Add CSS class to PHP Statement

You need to wrap it in an HTML element that has a class. Doing it with your code will require changes. You can either do it outside the PHP, which will require changing where you open and close the PHP tags: <?php } else { ?> <span class=”classname”> <?php esc_html_e(‘No results found’,’ThemeName’); ?> </span> <?php … Read more

What’s the most efficient way to write multiple WP_Queries on a page?

You could move the query configs into one config array and loop that for querying the posts and rendering the content sections. Inside the content section partial you’d have another loop for the posts. The magic ingredient here is the third $args parameter you can use with get_template_part(). Use it to pass data to the … Read more

WordPress developer

Even though technically WordPress is a Content Management System (CMS), I think of it as a framework. It provides templating, caching, routing, database abstraction, etc. If you want to be a WordPress developer you need to know PHP, obviously, but you also need know how WordPress uses PHP and get familiar with the “WordPress Way” … Read more