How to perform str_replace on the results of wp_list_pages

Change your $child in your code to $InnerPages, like this: $InnerPages = wp_list_pages(‘child_of=”.($post->post_parent != false ? $post->post_parent : $post->ID).”&title_li=&echo=0’); $InnerPages = str_replace(‘<ul class=”children”>’, ‘<ul class=”children”><li>Overview</li>’, $InnerPages); echo $InnerPages; You were saving your change in $child but then displaying $InnerPages which was unchanged. Additionally the class is children and not child and must match exactly to … Read more

Creating Slider in wordpress theme with custom post

Perhaps in your post loop you would need to add a condition that checks for post type, using the get_post_type() function. So something like this: <?php if(have_posts()) : ?> <?php while(have_posts()) : the_post(); ?> <?php if(get_post_type(get_the_ID()) === ‘your custom post type’) : ?> //Your slider code with current post data <?php endif; ?> <?php endwhile; … Read more

Looping single post in a theme

Firstly, you don’t need to check with is_single() in single.php. WordPress will automatically recognize it for single post. Secondly, breakdown your template with in parts. Such as break your main loop code in content-single.php and call it in single.php with get_template_part(‘content’, ‘single’). So you single.php template will look like below- <?php while ( have_posts() ) … Read more

Breaking Categories Up into Individual Divs

You can customize the way wp_list_categories() render the categories by using a custom Walker and pass it as an argument of the function : $args = array( ‘show_option_none’ => __( ‘No treatment categories’ ), ‘taxonomy’ => ‘treatment-categories’, ‘title_li’ => __( ‘Treatment Categories’ ) ‘title_li’ => ”, ‘walker’ => new My_Walker_Category() ); if ( count( get_categories( … Read more