- This topic has 8 replies, 2 voices, and was last updated 5 years, 11 months ago by Leo.
-
AuthorPosts
-
May 27, 2018 at 5:31 pm #585915Tom
I am trying to begin a blog at http://ethericstudies.org/opinion/ that will only display articles written in Category:opinion. I am using the Blog plugin that is bundled with the Pro version of the GeneratePress template. I am also using Snippit and Simple CSS.
My challenged thus far is to restrict the display to just articles in the opinion category. Right now it shows everything.
I found a bit of code in one of the other posts:
function generate_dequeue_scripts() {// If the category ID is 20, dequeue masonry
if ( is_category( ’20’ ) ) :
wp_dequeue_script( ‘blog-scripts’ );
wp_dequeue_script( ‘jquery-masonry’ );
wp_dequeue_script( ‘blog-imagesloaded’ );
wp_dequeue_style( ‘blog-styles’ );
endif;}
add_action( ‘wp_print_scripts’, ‘generate_dequeue_scripts’, 100 );
add_action( ‘wp_enqueue_scripts’, ‘generate_dequeue_scripts’, 100 );(My opinion category is “20.”)
I also incorporated:
.category-20 .page-header,
.category-20 .inside-article {
margin-right: 0;
}The code made no difference.
Any idea how I can limit the display to one category?
May 27, 2018 at 8:28 pm #585947LeoStaffCustomer SupportHi there,
Give this a shot: https://generatepress.com/forums/topic/multiple-static-frontpage-selected-posts-on-frontpage/#post-157558
May 28, 2018 at 9:34 am #586412TomThanks for the response Leo.
I placed this from that other post:
function generate_opinion_category( $query ) {
if ( $query->is_opinion() && $query->is_main_query() ) {
$query->set( ‘category_name’, ‘opinion-category-slug’ );
}
}
add_action( ‘pre_get_posts’, ‘generate_opinion_category’ );I changed it from “home” to “opinion. When it was still “home”, the page showed “Nothing Found.” When I changed it to “opinion,” the page showed as before with the opinion category first and then everything else.
Perhaps the code needs to be changed to limit the display to “opinion.” Right now, it is displaying as if “opinion” is just a priority.
May 28, 2018 at 11:10 am #586461LeoStaffCustomer SupportMight be easier to just use Tom’s WP Show Posts: https://en-ca.wordpress.org/plugins/wp-show-posts/
It’s design for this purpose ๐
May 28, 2018 at 2:35 pm #586600TomI see references to that WP Show Post here and there on the board but could not figure out how to configure it to display only one category.
Can you tell me where to access that control?
May 28, 2018 at 8:47 pm #586707LeoStaffCustomer SupportTry creating a new list, then in Posts tab select Taxonomy > category.
May 29, 2018 at 10:35 am #587240TomThanks Leo! That worked. I had already tried that plugin and did not see the Taxonomy list arrow. I deleted the old try and set up a new one and it did show the list arrow and the plugin worked fine.
With that said, I went back and tried just the plugin that is bundled with the premium and it also worked with only the intended category. I have to assume it is operator error.
The difference in display is that the bundled version does not show the sidebar which is okay. It does feature the newest entry across two columns. That is a nice touch. So I am going to mark this as resolved. Thanks for the help.
PS: I think the reason the bundled plugin worked is that I went to the category page first. The way I have it set up now that works, but there are so many different variations I am still trying to figure out what I am doing. If I can’t figure it out, I will initiate a new ask for help.
May 29, 2018 at 1:33 pm #587343TomOkay, so I found that using Settings > Reading > and selecting any Blog page as the Post Page supersedes all other commands. Returning that setting to “Select” will allow the “WP Show Posts” to function as advertised. I am all set, thank you.
May 29, 2018 at 2:02 pm #587377LeoStaffCustomer SupportGlad you figured out ๐
-
AuthorPosts
- You must be logged in to reply to this topic.