Why does my short code get executed before other content?
By popular demand: The solution is simply to replace print to return . Shortcodes should always return the value instead of printing or echoing it out.
By popular demand: The solution is simply to replace print to return . Shortcodes should always return the value instead of printing or echoing it out.
You could also use this function: set_query_var(‘foo’, $foo); WP will extract and expose all query variables in every template it loads, so you will be able to access it as $foo
The source for the gallery shortcode is in wp-includes/media.php. There are a couple of hooks in there that might work for you. Without knowing exactly what you want to do, it is impossible to be more specific. If that doesn’t work then you can remove the shortcode: remove_shortcode(‘gallery’); And add another gallery shortcode with the … Read more
This conflict normally happens when a custom post type archive and a normal wordpress page has the same slug. The custom post type archive has the higher priority here. If you have a custom post type by the name ‘Projects’ and ‘has_archive’ is set to true for the custom post type then the conflict will … Read more
Please consult the Template Hierarchy, and ensure that you are using the correct names for template files. index.php should be left as the default fallback for all other template files The site front page template file name is front-page.php. You need to rename your homepage.php as front-page.php The blog posts index page template file name … Read more
Typically I wouldn’t follow such a strong answer like the one @Milo provided with a post like this. Since I already had this code written for another project I thought I’d share. The code below does everything @Milo summarized in his answer and I’ve ported this across projects before with great success. Here’s the cheat … Read more
There isn’t an easy way to do this at this time. Check out this question’s answers for some potential work arounds.
I figured it out. Thanks to an answer posted here. The code is $term_slug = get_query_var( ‘term’ ); $query_args = array( ‘taxonomy’ => ‘news_category’, ‘term’ => $term_slug, ‘post_type’ => ‘news’ );
Handle built in sizes right I wrote a class that handles all the different stuff for built in image sizes. To redefine the built in sizes, use an extended class (the upper file in the linked source) To unset a class and skip it’s useage completely, just set w & h to 0. http://static.steffenvogel.de/wp-content/uploads/2011/07/octocat_construction.gif Click … Read more
Try this – I’ve not implemented it fully, but I have tested it and it seems to work. Place it in your functions.php and call <?php list_child_pages(); ?> in your template or use the shortcode [childpages] in your editor. <?php // List Child pages of a parent. function list_child_pages() { global $post; if ( is_page() … Read more