-
AuthorPosts
-
September 30, 2014 at 8:32 am #115554
Hi!
I’m setting up a blog page on a website but only want to show a few specific categories on it. Or better yet exclude one category so it does not appear on that page. Is that possible? And how do I do that?
Thanks!
//Karolina
September 30, 2014 at 9:11 am #115592I have used this plugin in the past https://wordpress.org/plugins/frontpage-category-filter/ and it worked well. You could also set up a child theme. This allows you to make code changes that won’t be overwritten when an X update is released. After your child theme is setup, please review how we recommend making template changes in Customization Best Practices.
Once your child theme is set and you know what categories you want to include the next step is to add this code to your function.php file:
function my_home_category( $query ) { if ( $query->is_home() && $query->is_main_query() ) { $query->set( 'cat', '11'); } } add_action( 'pre_get_posts', 'my_home_category' );
If you would like to include more than one category, then just add another ID by inserting a comma and the ID number. For example, this is will display category 11 and category 14.
$query->set( 'cat', ’11, 14’ );
October 1, 2014 at 7:23 am #116274Thanks!
That plugin where unfortunatly to old but I found a similar one.
I would like to implement the meta as it displays in the original blog page
and tried to implement this: <?php x_renew_entry_meta(); ?> on the plugins index-page
But it did not work as I wanted. Is there a way to write it out så that it will fetch the icons correctly?I’m searching the code but it is surely complex. (in a positive way though) 😉
October 1, 2014 at 7:50 am #116296Hi Karolina,
Would you mind providing additional details about your modification?
Does the plugin you used have its own blog or custom template? Can you provide the page you are customizing.
Unfortunately, we have limited support on third party plugin, but I wanted to see if it can be easily done on your case.
Cheers
October 1, 2014 at 9:23 am #116368I have managed to solve it. 🙂
I added the icons by the <i> and used the normal get_author and so on to the rest.
Thanks for your help!
October 1, 2014 at 10:03 am #116402You’re most welcome Karolina! 🙂
October 20, 2014 at 8:22 am #128483Hi again!
Sorry to bring this qt up again but I have more problem. 🙁
I thought I had solved this case but it seems that when I add more blog posts
not all are shown and how to add the more pages like this:
http://twentytwelvedemo.wordpress.com/blog/The best possibility where to display my blog sort of like this:
http://theme.co/x/demo/integrity/1/blog/But with whole posts of course. 🙂 And with the possibility to only show posts from one category.
Hope there is a soloution for this. 😀
October 20, 2014 at 12:09 pm #128627Hi there,
would you please share the code that you are using now? Do you use a plugin that you have mentioned before or a code snippet inside your Child Theme?My guess is that pagination is the problem now and we should check your code to see if we can help or not.
By the way I also suggest that you go to settings -> reading -> posts per page and set it to a big amount and see if it works for you.
Thank you.
October 21, 2014 at 4:24 am #129069I’m using this plugin: https://wordpress.org/plugins/posts-from-category/
But I have altered it a bit so that it shows the_content instead of the_excerpt
and also so that it shows the icons that the X theme uses for author, date and category-tag.The very best would of course be if I could create a child theme and use your existing settings and alter them so that I can show the whole content and only from one category.
However I would much rather skip the child-theme and use some plugin if that was possible. 🙂
October 21, 2014 at 10:37 am #129291Seems like you were able to get everything working nicely and still able to avoid the child theme. Let us know if you need anything else.
October 22, 2014 at 6:26 am #129832Well not really. Cause when it gets over a certian number of posts they doesn’t show even if I haven’t entered any number of posts maximum. And I would like to have the page numbers show at the bottom but that is not included in this plugin. So let’s say I want to have 10 posts on the main blog page but have 30 posts. I want the page number 1 2 and 3 to show at the bottom. Is there a way to fix that?
October 22, 2014 at 1:52 pm #130113Hi There,
I’m not really sure about the whole functionality of the plugin you used.
But you could call the wordpress pagination by adding <?php pagenavi(); ?>
Would you try adding that function on your customization, or can you try contacting the plugin author on how to add pagination when using that plugin.
Hope that helps,
Have a great day
July 2, 2015 at 10:33 am #319328Hi I just used the above code to try and turn on the excerpts on my front page and it whited out the site? Any ideas?
July 2, 2015 at 4:43 pm #319622Hello There,
Thanks for posting in and giving your site URL. Upon checking your site is now ok.
A white screen usually means there is a fatal PHP error. You can enable WP_DEBUG mode to see the error. You can do this by openingwp-config.php
and adding
define( 'WP_DEBUG' , true );
just above/* That's all, stop editing! Happy blogging. */
For example:define('WP_DEBUG', true); /* That's all, stop editing! Happy blogging. */
When you revisit the page with the white screen, you should have some error output describing the issue in more detail.
Hope this helps.
-
AuthorPosts