Shortcode / plugin with custom (flexible) output

The first problem you didn’t even mention is: you are putting shortcodes into a theme. Shortcodes are pure plugin territory, because they are changing post content and must survive a theme switch. Once you fixed that and moved the shortcodes to a plugin named inferno_shortcodes, the rest is easy: In your plugin ask for theme … Read more

Post Templates and Post ID’s

But for some reason my posts get overridden instead of displaying new data. The problem is here: $announcements->query(‘showposts=1&cat=$category_id’); You are trying to use a variable inside a single quote string. Variables do not expand inside single quotes so instead of asking for cat=1, or cat=2, you are literally asking for cat=$category_id— just like that, spelled … Read more

Create a custom taxonomy template that loops through child categories in term order?

Here’s what we’ve come up with so far, and there’s definitely room for improvement. remove_action( ‘genesis_loop’, ‘genesis_do_loop’ ); add_action( ‘genesis_loop’, ‘ahso_custom_taxonomy_archive_loop’ ); function ahso_custom_taxonomy_archive_loop() { global $wp_query; // globalize it. // get category ID $cat_id = $wp_query->get_queried_object_id(); // get current category // get all child categories $cat_args = array( ‘type’ => ‘products’, ‘child_of’ => $cat_id, … Read more

How to create a title images for different posts?

You can simply use the featured image. Just output it where you want it to appear <?php the_post_thumbnail( $size, $attr ); ?> Use accordingly a class or a ID to style it with CSS. Take a look there: https://codex.wordpress.org/Post_Thumbnails to abilitate the featured image in your theme.

Dynamically generated URL and Content page

Firstly, don’t forget to always flush your rewrite rules by going to Settings -> Permalinks and just clicking on Save Changes Now on your problem, it seems that you’re missing an ‘&‘ in your query: $new_rules[‘^test-directory/(.*)/(.*)’] = ‘index.php?test-directory=$matches[1]&test-code=$matches[2]’; Notice the & after $matches[1] On the other hand, your ‘template_redirect’ action is not calling the correct … Read more

I would like to feature a tip on the homepage

You can place another loop on the template, for example below the first loop. Multiple loops documentation: http://codex.wordpress.org/The_Loop#Multiple_Loops_Example_1 <?php if (have_posts()) : ?> <?php while (have_posts()) : the_post(); ?> <!– your first loop … –> <?php endwhile; ?> <?php endif; ?> <?php wp_reset_query(); $tips_query = new WP_Query( ‘category_name=tips&posts_per_page=1’ ); ?> <?php if ($tips_query->have_posts()) : ?> … Read more