Having trouble showing more blog posts on my grid blog layout
The answer is in your query itself $the_query = new WP_Query(“showposts=6&orderby=date”); showposts attribute is set to 6, change it to the number you prefer.
The answer is in your query itself $the_query = new WP_Query(“showposts=6&orderby=date”); showposts attribute is set to 6, change it to the number you prefer.
If you can live with manually deciding what your best posts are, Sticky Posts would be the way I´d choose. The Codex already has code for the 5 latest sticky posts: /* Sort Sticky Posts, newest at the top */ rsort( $sticky ); /* Get top 5 Sticky Posts */ $sticky = array_slice( $sticky, 0, … Read more
You may edit the query using the pre_get_posts action. You can do something like this: add_action(‘pre_get_posts’,’wpse_218948_search_filter’); function wpse_218948_search_filter(){ if( is_page(‘blog’) /* or whatever page it is */ && $query->is_main_query() ){ $query->set(‘post_type’, ‘blog’); # query post type “blog” $query->set( ‘posts_per_page’, -1 ); # display all posts } }
First check your template or source code to find the classes added to the article as a whole (or any html element that wraps around the whole post. It probably looks a bit like this: <article class=”my-article”> <title class=”my-title”>TITLE</title> <img src=”https://wordpress.stackexchange.com/questions/228934/…” class=”my-featured-image”/> <div class=”my-content”> POST TEXT </div> </article> Now, in your style.css file you must … Read more
your title tag is inside the script tag. It must be placed outside script. So you have to close the script tag for “adsbygoogle”.
Copied from the WordPress developer documentation on ‘Template Hierachy’, the blog template is displayed using the following template file rules: If your blog is at http://example.com/blog/ and a visitor clicks on a link to a category page such as http://example.com/blog/category/your-cat/, WordPress looks for a template file in the current theme’s directory that matches the category’s … Read more
You don’t need functions for this, just look in your theme’s template files: For single posts check single.php and for blog archive/categories check archive.php. Change the <h6> in those php files to <div> or whatever you want. It would be wiser to override them with a child theme so you don’t lose your changes in … Read more
You can use get_queried_object() to get the static page data, and then do something like so to get the excerpt of the page: echo get_the_excerpt( get_queried_object() ); // Or to apply filters just as the_excerpt() does: $excerpt = get_the_excerpt( get_queried_object() ); echo apply_filters( ‘the_excerpt’, $excerpt );
In WordPress, we have what is called as “main query” which points to the global $wp_query object (which is an instance of the WP_Query class), and this main query is run on page load after WordPress parses query arguments from the current URL (or the relevant query for the matching rewrite rule for that URL). … Read more
you can try this one function exclude_some_post_type($query) { if ( ! is_admin() && $query->is_main_query() ) { if ( $query->is_search || is_home() ) { // in search page $query->set( ‘post_type’, ‘post’ ); } } } add_action( ‘pre_get_posts’, ‘exclude_some_post_type’ ); The function that applied to a pre_get_posts hook will set only default post type (post), and will … Read more