-
AuthorPosts
-
November 7, 2014 at 9:43 am #347593
Hi,
Is there any way to highlight sticky posts in the blog with either changed font color or an automated addition to the post headline? I use the plugin Scheduled Content Action to remove the sticky feature at certain dates and I then want the highlighted part of the post to be removed and reverted to its original style.
If found this at http://wordpress.stackexchange.com/questions/3615/highlight-a-featured-post:
To add some text to your featured posts and highlight them, add a function like this inside the loop in your index.php (or loop.php, etc., depending on your theme):
if (is_sticky($post->ID)) echo ‘<span class=”featured”>Featured!</span>’;You can do the same thing with the css :before property, like this:
div.sticky h2:before {
content: “Featured! “;
}(assuming you’re using h2’s to display the titles of your posts, and you want to add the text before the title)
November 7, 2014 at 5:28 pm #347807Hi kihlbaum!
This CSS will change the post title color and add a “Featured!” to the beginning of the title.
.sticky .post-title:before { content: "Featured!"; } .sticky .post-title { color: red !important; }
Cheers!
Elliott- This reply was modified 10 years ago by Elliott.
November 7, 2014 at 6:02 pm #347834Great! Thanks.
This is one of Kriesis strengths: your incredible support!Regards,
Lars
November 7, 2014 at 6:47 pm #347860Hi, how can i reproduce the same thing here on homepage. Sticky post example “Facciamo all’amore: i 5 luoghi migliori dove infrattarsi a Taranto” (last one in the first row). Here title post is h3. Thanks
November 7, 2014 at 10:51 pm #347975Hey!
For that you’ll need to open up /enfold/config-templatebuilder/avia-shortcodes/postslider.php and find line 289.
$post_class = "post-entry post-entry-{$the_id} slide-entry-overview slide-loop-{$post_loop_count} slide-parity-{$parity} {$last}";
And add this beneath it.
if ( is_sticky( $entry->ID ) ) { $post_class .= ' sticky'; }
And then use this CSS.
.sticky .entry-title:before { content: "Featured!"; } .sticky .entry-title { color: red !important; }
Cheers!
Elliott- This reply was modified 10 years ago by Elliott.
-
AuthorPosts
- You must be logged in to reply to this topic.