Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #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)

    #347807

    Hi 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, 1 month ago by Elliott.
    #347834

    Great! Thanks.
    This is one of Kriesis strengths: your incredible support!

    Regards,

    Lars

    #347860

    Hi, 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

    #347975

    Hey!

    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, 1 month ago by Elliott.
Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.