PHP Catchable fatal error: Object of class WP_Error could not be converted to string

Line 58 as the error indicates is this line: $parent_term = get_term_by(‘ID’,$term_id, $taxonomy); $term_parents = $delimiter.”<a href=\””.get_term_link($parent_term->slug,$taxonomy).”\” title=\””. $parent_term->name .”\” >”. $parent_term->name .”</a>” .$child_terms; And our error is: Object of class WP_Error could not be converted to string Which means that one of those things being appended is not a “string”, but actually a WP_Error … Read more

Multiple is_page() in page.php

You can pass an array of IDs to is_page instead of using multiple is_page: if( is_page( array( 11, 22, 33, 44 ) ) ) { // Your code } Also, if you are using it in a loop, you should consider this note: Due to certain global variables being overwritten during The Loop, is_page() will … Read more

How do I use Shortcodes inside of HTML tags?

Hope this helps someone: Instead of doing this: <a href=”https://example.com/folder/edit.php?action=someaction&id=[foocode parameter=”value”]&edittoken=[foocode parameter=”othervalue”]”>linktext</a> You can do this: [foocode parameter1=value parameter2=othervalue] and then do this: add_shortcode( ‘foocode’, ‘prefix_foocode’ ); function prefix_foocode( $atts ) { // Normalize $atts, set defaults and do whatever you want with $atts. $html=”<a href=”https://example.com/folder/edit.php?action=someaction&id=” . $atts[‘parameter1′] .’&edittoken=’ . $atts[‘parameter2’] . ‘”>linktext</a>’; return $html; … Read more

How to Add Custom Fields to Custom Taxonomies in WordPress CLEANLY

Option 2 is the cleanest method – which I’ve also used a number of times. Unfortunately, there is no default term_metadata table in WordPress yet. This post also covers the same approach, http://shibashake.com/wordpress-theme/add-term-or-taxonomy-meta-data And of course, there’s a plugin for that too 🙂 http://wordpress.org/extend/plugins/taxonomy-metadata/

How can i remove all html tags from get_the_content()?

The WordPress function, at least the one I tend to use, would be wp_filter_nohtml_kses. That should remove all of the HTML, but you need to be careful not to put some HTML back by running the_content filters on your HTML-less string. I am not sure why strip_tags didn’t work, but I suspect that you doing … Read more

why is translation not working on theme?

I downloaded the free Rookie parent theme and have no problem displaying translations of “Search Results for: %s” on a successful search results screen. This works in the WordPress languages folder at wp-content/languages/themes/rookie-de_DE.mo as well as Loco Translate’s custom directory. It works there if the files are named correctly because the parent theme correctly loads … Read more

How does WordPress support Unicode?

WordPress is written in PHP. As far as I know, PHP doesn’t support any character encoding (UTF-8, UTF-16, …). It just assumes the text to be ASCII encoded. The actual encoding and decoding is done by your browser. When you write a post, your browser sends the text you just entered as UTF-8 to the … Read more