Error in Wordprewss loop for page template [closed]

I wasn’t able to recreate the error. Maybe it’s coming from <?php get_sidebars(‘right’); ?> I did change your code a little, but it didn’t give the “unexpected endwhile” error you spoke of. If it’s coming from line 1 I’d guess it’s the header.php file? Here is the adjusted code if you want to try it: … Read more

Fix html inside a for loop [closed]

First of all you have the PHP syntax all messed up. Second, you misused some WordPress template tags – you already echo the entire link like so you need to return post permalink and title, but right now the_permalink and the_title_attribute functions echo the code. Here’s your code fixed: foreach( $terms as $term ) : … Read more

Same posts within a paginated page

The problem is that you are running query_posts in the middle of the page, which, by the way you should nearly never do. That will overwrite the main query– the global $wp_query object. Pagination should probably appear to work. The problem is that the original main query runs before your template loads and thus before … Read more

Best hook for a function which adds shortcodes to the system?

If I’m following things correctly, I think the problem is that your shortcode callback echoes, rather than returns its content – and that you have it set up that way in order for the shortcode content to output outside of the post content. If that’s the case, you’re taking the wrong approach. Your shortcode callback … Read more

the_content() “crashes” for single pages

the_content( ); vs get_the_content(); The different is pretty simple actually. If you find yourself annoyed with formatting of the content, more specifically the added p-tags that WordPress puts into the content that you didn’t. Just use get_the_content(); and you will remove those tags. Normally the get_the_content() tag returns the content WITHOUT formatting. Only the_content() will … Read more

repeating posts on 2nd page to posts

Use this in your child themes functions.php file add_action( ‘pre_get_posts’, ‘exclude_category_posts’ ); function exclude_category_posts( $query ) { if( $query->is_main_query() && $query->is_home() ) { $query->set( ‘cat’, ‘-27,-30′ ); } } Add a comma separated list of category i.d’s to the set. Never Use Query Posts