• Resolved JG99

    (@jg99)


    Hello, I am really struggling with this plugin, trying to get it to work properly. I want it to display different categories for individual posts. Anybody had success with it?

    Thanks for the feedback.

Viewing 15 replies - 1 through 15 (of 21 total)
  • I want it to display different categories for individual posts.

    Are you saying you want to displayed different widgets based on the category for an individual post when viewing that single post?

    Note: I also deleted your duplicate topic.

    Thread Starter JG99

    (@jg99)

    Hello MichaelH

    Thanks for trying to help me.

    Let’s say my blog URL is DeliciousFoodRecipesDOTcom.

    First posting (only one post per page)
    “Italian Food Recipes” ————————————
    ———————————————————–CATEGORIES
    ———————————————————–“Spaghetti”
    ———————————————————–“Tortellini”

    Next posting (again, one post per page)
    “Mexican Food Recipes”————————————–
    ————————————————————CATEGORIES
    ————————————————————“Tacos”
    ————————————————————“Burritos”

    What I want to be able to do is dictate what appears on the right margin in “Categories,” so that each post only shows the category or categories that I have assigned to that one specific post.

    As is stands now, with every posting ALL categories are listed, which means the sum of all my blog posts and the total number of categories I have created. Instead, I want to be able to control which categories are showing on which posts/pages.

    I heard Slayers plugin would do the trick, but it’s not working. I have tried every possible combination of settings!

    Thank you again for trying to help me.

    Thread Starter JG99

    (@jg99)

    MichaelH, I came across this thread, would this coding do the trick?

    https://yoast.com/showing-subcategories-on-wordpress-category-pages/

    The only issue for me is that I don’t want subcategories. I simply want to control which categories appear on which postings.

    <?php
    //for 'first post' in wp_query display categories on that post
    $postid = $wp_query->posts[0]->ID;
    $postcats = get_the_category($postid);
    $ids=array();
    if ($postcats){
      foreach ($postcats as $postcat) {
        $ids[]=$postcat->cat_ID;
      }
      $cats = implode(",", $ids);
      $wlc_param_list='orderby=name&show_count=1&title_li=Categories on first post&include=' . $cats;
      wp_list_categories($wlc_param_list);
    }
    ?>
    Thread Starter JG99

    (@jg99)

    MichaelH, thank you very much – where do I put this code?

    In a sidebar.php

    Thread Starter JG99

    (@jg99)

    MichaelH, thank you again – Do I put this code in the WordPress sidebar, or in the sidebar for my particular theme? I have downloaded both sidebar.php files, and they are very different! The WordPress sidebar.php has many more lines of code in it. What is the starting and ending point for the code you have written above?

    Thank you again, I am sorry for my lack of knowledge in this area!

    You would put that in your theme’s sidebar.php.

    See
    Stepping Into Template Tags
    Stepping Into Templates
    Template Hierarchy

    Thread Starter JG99

    (@jg99)

    OK, thank you – I will do some reading as you suggest and let you know how it goes!

    Appreciate the help!

    Thread Starter JG99

    (@jg99)

    MichaelH, I am sorry to disappoint you. I am unable to figure out where to add the section of code you so kindly provided. Here is the text version of my sidebar.php file from my theme. Where should I add the code?

    <?php thematic_abovemainasides(); ?>

    <?php if (is_sidebar_active(‘primary-aside’)) { ?>
    <div id=”primary” class=”aside main-aside”>
    <ul class=”xoxo”>
    <?php dynamic_sidebar(‘primary-aside’); ?>

    </div><!– #primary .aside –>
    <?php } ?>

    <?php thematic_betweenmainasides(); ?>

    <?php if (is_sidebar_active(‘secondary-aside’)) { ?>
    <div id=”secondary” class=”aside main-aside”>
    <ul class=”xoxo”>
    <?php dynamic_sidebar(‘secondary-aside’) ?>

    </div><!– #secondary .aside –>
    <?php } ?>

    <?php thematic_belowmainasides(); ?>

    Looks like it might be better to download and install Otto’s PHP Code Widget, then put that code in one of those widgets.

    Thread Starter JG99

    (@jg99)

    MichaelH, may I ask why you feel this is the best option?

    Because it seems your theme supports widgets.

    Thread Starter JG99

    (@jg99)

    OK, I will try – I appreciate your continuing support.

    Thread Starter JG99

    (@jg99)

    MichaelH, do I change the execphp.php extension to .txt and then insert your code? And then upload it to my plugins folder? Here is the content of execphp.txt, I am sorry but this looks pretty complicated! Could you tell me please where to insert the code?

    [code moderated]

    === PHP Code Widget ===

    Like the Text widget, but also allows working PHP code to be inserted.

    == Description ==

    The normal Text widget allows you to insert arbitrary Text and/or HTML code.
    This allows that too, but also parses any inserted PHP code and executes it.
    This makes it easier to migrate to a widget-based theme.

    All PHP code must be enclosed in the standard <?php and ?> tags for it to be
    recognized.

    == Installation ==

    1. Upload execphp.php to the /wp-content/plugins/ directory
    1. Activate the plugin through the 'Plugins' menu in WordPress
    1. Use the widget like any other widget.

    == Frequently Asked Questions ==

    = There's some kind of error on line 43! =

    That error means that your PHP code is incorrect or otherwise broken.

    = No, my code is fine! =

    No, it's not.

    Really.

    This widget has no bugs, it's about the simplest widget one can possibly
    make. Any errors coming out of the "execphp,php" file are errors in code you
    put into one of the widgets. The reason that it shows the error being in the
    execphp.php file is because that is where your code is actually being run
    from.

    So, if it says that you have an error on line 43, I assure you, the problem
    is yours. Please don't email me about that error.

Viewing 15 replies - 1 through 15 (of 21 total)
  • The topic ‘Slayers Customs Widgets Plugin – HELP’ is closed to new replies.