I have a few posts with the same category that are being used by a separate plugin on my site, but due to them being a post in the posts section, this is also displaying as a blog post, in addition to the page loading the plugin to display these posts.
I would like to exclude this category from being displayed in the Fatmoon blog page but continue to display it in the plugin they are being used on.
I wanted to add the script below to the functions.php file but this has been overidden to load the fatmoon framework:
function exclude_category($query) {
if ( $query->is_home() ) {
$query->set('cat', '-CATEGORYNAME');
}
return $query;
}
add_filter('pre_get_posts', 'exclude_category');
Any ideas where I need to add this script, or if there is a much simpler way to exclude a certain category from the blog posts?
Thanks
Comments
FatMoon uses standard blog mechanics so it shouldn't be the problem.
With kind regards.
So I want to add the following script to ignore the blog category which is called "Client", which has the ID of 269 (see screenshot here https://cl.ly/0h1S3b2M3H0N/Screen Shot 2017-02-17 at 14.37.09.png)
Even if I add this script to the top of the existing code after the
<?php
or at the end of the current code, the category still shows up on the blog post sorting list, but it DOES hide the actual posts...so there is no posts showing, but the category does (see here: https://cl.ly/0W0X2A3K0f1N/Screen Shot 2017-02-17 at 14.49.00.png)Is there another snippet of code I need to add so it ignores this category from displaying, instead of just the content within this category?
Thanks
Try doing such change:
go to fatmoon\parts\category-filter.php line ~81 where you have: and change it to Tell me does it solve your case:-)
With kind regards.
This article is one of the posts that has the category ID 269 which I have excluded. Can you please tell me where I add the ID to exclude this here also please?
Also, on a separate note, is there a way I can edit this area so I can display the main post image thumb of the blog post in between the previous/next article nav and the blog titles? Please see attached mockup: https://cl.ly/0a0w0S0P3s1W/Screen Shot 2017-02-18 at 07.33.28.png
In the mockup I set this to 245px wide, so any custom script you can advise me would be much appreciated!
Thanks
Go to fatmoon\advance\utilities\posts.php line ~259
and change: to:
A bit lower in same file you have HTML where you can add such PHP code where you need it exactly:
apollo13framework_make_post_image( $id, array( 245, 100 ))
Hope that helps.
With kind regards.
My php knowledge is very minimal i'm afraid, so as you can imagine, the moment I added:
apollo13framework_make_post_image( $id, array( 245, 100 ))
it killed the site!
Basically I want this to be like the following:
Therefore is there some other script I need to add to support this new line, so it can reference the correct images?
Thanks in advance
Go to fatmoon\advance\utilities\posts.php line ~267. We have there such code You need to change it to: You can change those numbers in
array( 245, 100 )
to your needs.You will also have to style your added image, but I suppose it will be easiest task ;-)
Glad you feel that way, it is very "heart warming" :-)
If you will continue to be our client for your next projects then it is best reward for us, as this tells us we do things right ;-)
With kind regards.
Thanks again!
I tried this on each element for previous and next images, which killed the page, so any help with just the function would be great! I used standard practice div class code, but added the ' ' as I saw this on other styles applied...
You need more "dots" to connect strings Should be fine:-)
With kind regards.
I have added and styled the thumbnail images so they are both responsive, which all works fine. My issue now is when I have a next and previous article next to eachother that contains a short title on one and a long title on the other one, which pushes one of the articles down to a new line to compensate for the text break.
Here is what I mean: https://cl.ly/440c101d2u3a/Screen Shot 2017-02-23 at 17.05.33.png
I tried adding a new div to wrap the first and second articles separately within the posts-nav div, which resulted in this: https://cl.ly/2z1h3V172p2k/Screen Shot 2017-02-23 at 17.11.00.png
The problem is, when I try to apply these div classes in the php file instead of through Firebug on the page, the layout never seems to turn out how I want for the previous post section!
So I think the easier option on this would be to add a char restriction on the titles instead, so that it only displays the titles on 1 line and ends with an ellipses at the end when there are too many chars, so it looks like this: https://cl.ly/263W1R1u0C3s/Screen Shot 2017-02-23 at 17.16.26.png
Can you please let me know what I need to add in order to achieve this? Its the same type of thing that is on the descriptions in the blog list, so I imagine its not too much code to add?
Thanks again
With kind regards.
With kind regards.