What kind of data is that?

It’s a serialized string. Here’s a good description of what it is: A PHP array or object or other complex data structure cannot be transported or stored or otherwise used outside of a running PHP script. If you want to persist such a complex data structure beyond a single run of a script, you need … Read more

My scripts-bundle.js file is getting sent to the browser as a stylesheet css file. Help!

Ok, I managed to solve this issue because I was using the wrong WP functions to point my child themes directory and thus my bundled javascript script. I cleared out my functions.php file and added the below and it all works now: function load_js_files() { wp_enqueue_script( ‘script’, get_stylesheet_directory_uri() . ‘/js/scripts-bundled.js’, array ( ‘jquery’ ), 1.1, … Read more

WordPress wp_insert_post() returns 0 but not not wp_error

It appears that you can ask wp_insert_post() to return a WP_Error on failure by setting the 2nd parameter to true (it defaults to false). So if you change $new_article_id = wp_insert_post($new_article); to $new_article_id = wp_insert_post( $new_article, true ); in your code, you should get WP_Error objects back that you can then inspect.

Proper indentation of code generated inside hooks

I don’t think correct global indentation is possible without massive (and inefficient) output buffering to change it. Since you are primarily interested in this for debug purposes I suggest using some tool that will format and color-code output (of any page btw, not just those that you control). Firebug and View Source Chart work nicely … Read more

Need resource on available functions and objects

Hi @menardmam: Let’s try with what I wrote in the question : $cat->cat_name. How can I know that cat_name is a method that return something from $cat from get_the_category() function? Frankly the best way to know an answer like that is to use a debugging IDE and to trace through the WordPress core source code. … Read more

If in category to be inside of a function

If you want to use the function to output the code somewhere: function displayImage($currentPost) { // Show the featured icon only if current post is in “featured” category if ( in_category ( ‘featured’, $currentPost ) ) { $output=”<a href=”https://wordpress.stackexchange.com/questions/58811/<?php the_permalink(); ?>”> <span class=”featured_icon”> <img src=”<?php bloginfo(“template_directory’); ?>/images/featured_icon.png” /> </span> </a>’; } else { $output=”” }; … Read more

WP-Markdown treating java generics like HTML tags

I was trying to fix this for the longest time as well. It seems that the problem is not the rendering, but the editor – when you save, it updates your post. I found a checkbox under Settings -> Writing called “WordPress should correct invalidly nested XHTML automatically”. Unchecking this checkbox fixed the problem.

How to fix a “globals” issue to avoid a rejected theme?

If you’re dealing with framework that holds values in a global variable then there isn’t much you can do about it. Here is an example of wrapping the variable in a static getter. if ( ! class_exists( ‘SMOFData’ ) ): class SMOFData { static public function is( $key, $compare ) { $value = static::get( $key … Read more