Results 1 to 6 of 6

Thread: ** Anyone knows if a plugin for this exists? **

  1. #1
    Karl1's Avatar
    Karl1 is offline Hello World
    Join Date
    Jul 2011
    Location
    Seville, Spain
    Posts
    35

    Default [solved]** Anyone knows if a plugin for this exists? **

    Hi,
    I need to display a different icon in the sidebar if the page the visitor is on have some sort of customized field value.
    This is a learning style blog, and depending on the page I need to display BEGINNER, EASY, EXPERT, or some sort of colored icons.

    Any idea, even by coding it, I can code but don't quite know Wordpress

    thanks
    Last edited by Karl1; 09-23-2011 at 04:59 AM. Reason: Issue solved

  2. #2
    danix's Avatar
    danix is offline Hello World
    Join Date
    Sep 2011
    Location
    London
    Posts
    25

    Default

    the easiest way is to add some custom meta and then in your sidebar retrieve it.. doing this way you'll have to add a custom field when you write your post, and add the level of experience needed..

    I've been a bit vague, in case you need more help just ask.. ;)
    one day I will make a living out of WordPress...
    http://danixland.net | gpg-key: C4FAE66B | @danixland

  3. #3
    Karl1's Avatar
    Karl1 is offline Hello World
    Join Date
    Jul 2011
    Location
    Seville, Spain
    Posts
    35

    Default

    yes, thanks, I've already done it using:
    <div id="levelsign">
    <?php $value = get_post_meta($post->ID, 'nivel', true);
    if($value == '1') {
    echo '<img class="noborder-img" src="http://imagepath/help-green.png" width="25" height="25" alt="icon" />';
    } elseif($value == '2') {
    echo '<img class="noborder-img" src="http://imagepath/help-yellow.png" width="25" height="25" alt="icon" />';
    } elseif($value == '3') {
    echo '<img class="noborder-img" src="http://imagepath/help-blue.png" width="25" height="25" alt="icon" />';
    }
    ?>
    </div>
    in a separate php page
    then I call it inside the page template I want it to display:
    <?php include(TEMPLATEPATH . '/tutorial-info.php'); ?>
    so far working great by using a custom value "nivel: 1,2, or 3"

    :)

  4. #4
    danix's Avatar
    danix is offline Hello World
    Join Date
    Sep 2011
    Location
    London
    Posts
    25

    Default

    I'm glad you solved, however if you can, you should use the name of the level as alt text in your images.. just for the sake of accessibility.. ;)

    bye
    one day I will make a living out of WordPress...
    http://danixland.net | gpg-key: C4FAE66B | @danixland

  5. #5
    kovshenin's Avatar
    kovshenin is offline Hello World
    Join Date
    Sep 2011
    Location
    Moscow
    Posts
    14

    Default

    An easier option would be to use tags or categories to sort your posts into relevant levels (or maybe add a custom taxonomy called level) and then use CSS to style your posts according to their level. Make sure posts containers are using the post_class() function to render the CSS class names.

  6. #6
    Karl1's Avatar
    Karl1 is offline Hello World
    Join Date
    Jul 2011
    Location
    Seville, Spain
    Posts
    35

    Default

    have you read the OP, I want it in pages, not posts.
    Anyway it's working great
    thanks

    Quote Originally Posted by kovshenin View Post
    An easier option would be to use tags or categories to sort your posts into relevant levels (or maybe add a custom taxonomy called level) and then use CSS to style your posts according to their level. Make sure posts containers are using the post_class() function to render the CSS class names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •