Viewing 16 posts - 1 through 16 (of 16 total)
  • Author
  • #203

    Can i add new badges ? Like Premium Free Using Custom Fileds or tags?


    nice idea ;) it would be really great



    This isn’t built into the theme, but with a little customisation you could easily add this. I’ll pass this onto Kriesi for an answer as to whether this will make it into an updated version as a new function.



    Hey guys. Indeed a nice idea, but I am not sure yet if i will add this option since there are too many possibilitys to include them all. I will rather teach you how it is done ;)

    first of all you need to creat a new custom field when writing a post. Lets name it “premium” for now. now set the value to “1”;

    once that is done you need to tell the template file to do something with this value. I will demonstrate it at the example of index.php but you can also might add it to the single.php file, the galler y archive, etc.

    in index.php look out for line 30 which should read:

    $featured = get_post_meta($post->ID, "_prev_featured", true);

    add the following:

    $premium = get_post_meta($post->ID, "premium", true); //check if post has a premium mark

    now at line 57 you should find this:

    if($featured == 'yes') echo "<span class='featured_entry'></span>";

    this controlls if the featured_entry badge is shown by adding a span that gets a background image applied within your css files. simply follow it up with:

    if($premium == 1) echo "<span class='featured_entry premium'></span>";

    last thing to do is to add a new rule to your style.css file at the bottom that overwrites the featured background image that gets applied to the featured_entry class. thats the reason we set an additional premium class:

    #top .premium{
    background:url("images/skin1/premium.png") no-repeat scroll 0 top transparent;

    now you just need to create a badge called premium.png and you are done ;)


    Awesome trying it now

    Working gr8 tyvm

    But can i use tag instead of field ?


    you can try the following:

    instead of

    $premium = get_post_meta($post->ID, "premium", true); //check if post has a premium mark

    you can try this:

    $posttags = get_the_tags();
    $premium = $posttags[0]->name;

    and instead of this:

    if($premium == 1) echo "<span class='featured_entry premium'></span>";

    use this:

    if($premium == 'tagname') echo "<span class='featured_entry premium'></span>";

    of course you need to exchange tagname with the tagname you entered. also this will only work for the first tag applied to the entry


    Awesome thanks alot



    my pleasure ;)

    Best regards,



    Excellent tutorial Kriesi, thanks.

    If I want to add more custom fields like this , it does not work.

    What sould I do ?



    did you use another name for your second custom field – so instead of “premium” use something else like “special” and adjust the code above (by replacing the word premium with special)


    Hey Dude,

    of course…I want to add joomla,magento and drupal badge.


    Can you create me an admin account and send me the login details to: (Email address hidden if logged out) – I’ll have a look into it.


    danke Peter, habe gerade account hinzugefügt.

    Du hast schon bestimmt E-mail gekriegt….


    Ok it works now.

    Just call your post meta field wordpress, drupal, etc. and set the value to 1.

    I’ve set a drupal “featured badge”.


    danke Peter.Du bist great Supporter!


    Froh, dass ich helfen konnte :)

Viewing 16 posts - 1 through 16 (of 16 total)

The topic ‘Featured Badge’ is closed to new replies.