How to correctly escape data
You might want to check out WordPress official docs on this topic, in your case focus on escaping output https://codex.wordpress.org/Validating_Sanitizing_and_Escaping_User_Data
You might want to check out WordPress official docs on this topic, in your case focus on escaping output https://codex.wordpress.org/Validating_Sanitizing_and_Escaping_User_Data
Try this one : <?php $authordesc = get_the_author_meta( ‘description’ ); if ( ! empty ( $authordesc ) ){ ?> <div class=”blog-article-author”> //author info here… </div> <?php } ?>
You can use this inside your is_page() conditional : elseif ( is_page() ) { $paged = (get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1; echo $page_title . ‘ ‘ . $paged . ‘ of ‘.$wp_query->max_num_pages; } The other way to achieve the same thing. The conditional statement serves to avoid adding a 0 besides the title at the … Read more
So I got this to work by adding this function to functions.php // Custom query for events function set_posts_per_page_for_events_cpt( $query ) { if ( !is_admin() && $query->is_main_query() && is_post_type_archive( ‘events’ ) ) { // set date $currentdate = date(“Y-m-d”,mktime(0,0,0,date(“m”),date(“d”),date(“Y”))); $meta_query = array( array( ‘key’=>’event_date’, ‘compare’ => ‘>=’, ‘value’=> $currentdate, ‘type’ => ‘DATE’, ), ); $query->set(‘meta_query’, … Read more
Ok, so I think you could apply the codex example as is: function search_filter($query) { if ( !is_admin() && $query->is_main_query() ) { if ($query->is_search) { $query->set(‘post_type’, array( ‘post’, ‘actualizacion’, ‘notificacion’ ) ); } } } add_action(‘pre_get_posts’,’search_filter’); I think you were just missing the !is_admin() check in there… Hope this helps!
WP default loop will automatically show the posts with in current tag on tag.php page. you dont need to set custom WP_Query for that but make sure that you are not modifying the loop from any other method. if( have_posts() ) : while( have_posts() ) : the_post(); the_title(); //Rest of code. endwhile; endif;
This might work for you. try with enqueue instead of registering it. wp_deregister_script(‘jquery’); wp_enqueue_script( ‘jquery’, get_template_directory_uri() . ‘/js/libs/jquery-3.1.1.min.js’, array(), “3.1.1”, true );
If you want to defer loading of css, see CSS delivery optimization: How to defer css loading?. If you want to defer loading of js, you can use this: add_filter( ‘script_loader_tag’, function( $tag, $handle ) { return str_replace( “<script type=”text/javascript””, “<script type=”text/javascript” defer=”defer””, $tag ); }, 10, 2 );
You’re almost there my friend. Just check with $query->is_tag() rather than only is_tag(). So your updated code will be- function main_query_mods( $query ) { // check http://codex.wordpress.org/Conditional_Tags to play with other queries if(!$query->is_main_query()) { return; } if($query->is_tag()) { $query->set(‘posts_per_page’,10); } } add_action( ‘pre_get_posts’, ‘main_query_mods’ );
Disqus comments count taking long to update