Why is my category post repeating twice

You are calling a weird parameter in line 24 which i dont understand… did you copy paste this function from elsewhere? anyhow… change line 24 from: ‘$param_type’ => array($term->term_id), To this: ‘cat’ => array($term->term_id), Good luck and dont forget to read @toscho comment for future questions.

Strip from or something better?

Manipulating HTML with regular expressions is not a good idea. I suggest you use DOMDocument: // input $html = apply_filters(‘the_content’, get_the_content()); $dom = new \DomDocument(); $dom->loadHtml($html); $blockquotes = $dom->getElementsByTagName(‘blockquote’); foreach($blockquotes as $blockquote){ foreach($blockquote->childNodes as $e){ if($e->nodeName === ‘p’){ // create a text node with the contents of the <p> $blockquote->insertBefore($dom->createTextNode($e->textContent), $e); // remove <p> $blockquote->removeChild($e); … Read more

the_content not working on one of two Multisite sites

Check for any filters that only return if certain conditions are met. I had an issue once where almost all my pages’ content areas were blank. I found the problem was in a snippet of code that looked like this: add_filter( ‘the_content’, ‘this_will_blank_pages’ ); function this_will_blank_pages( $content ) { if( is_page( ‘some-page-title’ ) ) { … Read more

For Each +1 WordPress Loop

try yo use the build-in loop counter: <a data-slide-index=”<?php echo $wp_query->current_post; ?>” href=””><?php echo $imagethum; ?></a>

Advise on Templates for Custom Queries

I don’t really see anything wrong with what you’re doing; globalizing $post and using setup_postdata() are very standard, well-established techniques for dealing with posts that don’t come straight out of the standard loop; they’re not usually considered hacks.

List post only under the category, exclude child category content

to solve this you can create a page template, on this page template 1.get the top level categories only, set parent value to zero $args = array( ‘orderby’ => ‘name’, ‘parent’ => 0 ); $categories = get_categories( $args ); 2.get posts in all parent categories foreach ( $categories as $category ) { $all_posts=get_post(‘category=’.$category->term_id); foreach( $myposts … Read more