How to check for specific content in comments in the loop

I’ve answered my own question with some more reading and some messing around… I had to run a ‘foreach’ that cycles through the given post’s comments within the main loop. The following code looks at all the comments for each post that passes through the loop and checks for a specific string in the comments’ … Read more

Two loops by pre_get_post on same page

It will be good to know how you implement your code in header.php. You can try to move some condition to not affect all query? function my_pre_get_posts( $query ) { if ( is_admin() || ! $query->is_main_query() ) return; if ( is_post_type_archive( ‘propiedad’ ) ) { Becomes function my_pre_get_posts( $query ) { if(!is_admin()){ if ( is_post_type_archive( … Read more

custom wordpress post loop – hide iframe content

the best solution is to add filter in your functions.php : add_filter(‘the_content’,’show_only_thumbnails’,99); function show_only_thumbnails($content){ if(is_home() && is_front_page()){ //quote from : //http://wordpress.stackexchange.com/questions/218305/display-only-text-to-wordpress-loop-without-loosing-the-text-formatting/218314#218314 $content = preg_replace(‘/<iframe.*?>/’, “”, $content); // removes iframes return $content; } return $content; }

connect last post with first post

You may install this plugin and then for the next link, use: <?php c2c_next_or_loop_post_link(‘%link’,'<img src=”https://wordpress.stackexchange.com/questions/259353/img-location”/>’); ?> and for the previous link use: <?php c2c_previous_or_loop_post_link(‘%link’,'<img src=”https://wordpress.stackexchange.com/questions/259353/img-location”/>’); ?> That’s it. Now the previous link of your first post should be the last post and the next link of your last post should be the first post. If … Read more