- This topic has 13 replies, 2 voices, and was last updated 3 years, 3 months ago by
David.
-
AuthorPosts
-
January 20, 2023 at 7:42 am #2502935
Ella
Hi there,
I have category pages for my blog sections, which list all my latest posts within that category, but I wondered if it was possible to highlight a featured post at the top of them? EG here I want to add a master “Self Love Challenge” post, which is easy to find, then we display the rest of the posts relating to this, below it: https://www.forgettingfairytales.com/category/self-love/
Is this possible on a category page, or would I have to create a new normal page? And if I did – could I duplicate the exact format so it stays looking exactly like this? Then just add the extra “featured post” blog feature… and then how would I add that in?
Any guidance would be much appreciated!
Thanks so much,
EllaJanuary 20, 2023 at 10:48 am #2503289David
StaffCustomer SupportHi there,
Tricky one.
One possibility is to:1. Add a Tag of
featuredto the Post you want to display at the top.
2. Add this PHP Snippet to your site:add_action( 'loop_start', function( $q ) { if( $q->is_main_query() && $q->is_category() ) usort( $q->posts, function( $a, $b ){ return -1 * has_tag( 'featured', $a ) + 1 * has_tag( 'featured', $b ); }); }, 10, 2 );If that works we can talk about making that first post look different
January 23, 2023 at 7:36 am #2505875Ella
That doesn’t seem to have worked… unless I added it into the wrong place? Does a PHP snippet go under “Customise” and “Additional CSS” as that’s where I added it? I did also have a #Featured tag already but tried it with just Featured so that should have been okay there?
Let me know!
Thanks,
EllaJanuary 23, 2023 at 10:00 am #2506162David
StaffCustomer SupportIts PHP this doc explains:
https://docs.generatepress.com/article/adding-php/
TLDR:
Are you using a Child Theme?
If Yes, then the PHP goes in the Child Theme > functions.php
If No, then install the Code Snippets plugin ( link in the above doc ) and Add New Snippet to add the PHPJanuary 31, 2023 at 2:34 am #2515250Ella
Okay, added via Code Snippets and it didn’t work.
Instead of trying to feature a post on the top, can we instead, simply add a text box onto the category pages.
EG on the homepage, we have the “welcome to forgetting fairytales” text box: https://www.forgettingfairytales.com I’d like to be able to have text like this at the top of the category pages to introduce what it’s all about. EG above where the posts list starts here: https://www.forgettingfairytales.com/category/breakups/
Is this possible, and in an easier way at all?
Thanks so much,
EllaJanuary 31, 2023 at 5:44 am #2515406David
StaffCustomer SupportIf you edit a Category – do you have text in the Description ?
If so that could hooked into your page. Let me know.February 1, 2023 at 5:54 am #2516943Ella
Yes there’s a description box 🙂 Let me know what to do next! Thanks 😀
February 1, 2023 at 9:01 am #2517262David
StaffCustomer SupportWhilst viewing a category page, use the Admin Bar > Elements menu shortcut to edit the:
Archive Header Blockelement.
Beneath the Headline that is showing the title.
Add a GP Dynamic Content Block and set its Type to:Term Description.That will print the description below the title on archive pages..
February 1, 2023 at 9:12 am #2517272Ella
Amazing, thank you very much. Is there a way I can make the text smaller – particularly on mobile but also on desktop too? As even just a few sentences there, pushes the blog posts right down when it’s at that size on mobile. And the text on Desktop is also bigger than the logo and page titles too so it looks a little “shouty!” Please see here: https://www.forgettingfairytales.com/category/single/
Thanks,
EllaFebruary 1, 2023 at 9:21 am #2517281David
StaffCustomer SupportEdit the element.
Select the Container Block that the title and description is inside.
In its Typography settings, set a font size for Desktop and for Mobile. The description will inherit that size.For the Title, you can select its Headline Block and change its Typography font size
February 1, 2023 at 9:33 am #2517306Ella
Where is this sorry? I can’t see the Typography settings. I can only see editor width, element type, quick hooks, etc to the right, then below its just location etc. Am I looking in the wrong place?
Thanks,
EllaFebruary 1, 2023 at 9:37 am #2517310David
StaffCustomer SupportFebruary 1, 2023 at 9:42 am #2517321Ella
Oh perfect, thank you so much! I didn’t actually even know that was there. You’re fantastic. All sorted now then 😀
February 2, 2023 at 2:03 am #2518221David
StaffCustomer SupportGlad to be of help 🙂
-
AuthorPosts
- You must be logged in to reply to this topic.