Please help | Category related question

Discussion in 'WordPress' started by radiant_luv, Aug 14, 2010.

  1. #1
    Greetings,

    I have a bit of knowldge in XHTML/CSS however I am fairly new to WordPress. I just did my first wordpress based website for my portfolio http://inspirationsunlimited.co.in from a template "Simplefolio".

    If you visit http://inspirationsunlimited.co.in/portfolio, you'll find there are two categories at this moment "Web" , "Logo" and on click Portfolio on the navigantion it shows consolidated & latest post from both categories. and on click web or logo shows the post from specific categories. what i intend to do is on click of portfolio it should show post from category "web'. In a nutshell I want to link to a specific category on navigation "Portfolio".

    -is this doable? if yes, please give me some direction to achieve this.

    Thanks for you time.
    Radiant_Luv
     
    radiant_luv, Aug 14, 2010 IP
  2. Cash Nebula

    Cash Nebula Peon

    Messages:
    1,197
    Likes Received:
    67
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Have you tried selecting "Web" for Portfolio Category in the theme options?
    If that doesn't work, you can edit template-portfolio.php to make only the Web category appear.
     
    Cash Nebula, Aug 15, 2010 IP
  3. radiant_luv

    radiant_luv Peon

    Messages:
    1,327
    Likes Received:
    34
    Best Answers:
    1
    Trophy Points:
    0
    #3
    Thank you Cash Nebula for taking your time to reply.

    Yes, I did try setting "Web" as portfolio category in the theme options. However the output seemed to be broken. I remember i had to change a lot of html code to adopt my design. there html part of tags are missing when I select "Web" as portfolio category, obviously I am missing the correct .php file where I need to do alteration so that layout fits my design. I will try to post some screencaps when I'm back home.
    template-portfolio.php this I edited earlier to fit the look & feel of my design. Could you please shed some light what needs to be edit on template-portfolio.php to get the category to linked to web. I really appreciate your help and time.
     
    radiant_luv, Aug 15, 2010 IP
  4. Cash Nebula

    Cash Nebula Peon

    Messages:
    1,197
    Likes Received:
    67
    Best Answers:
    0
    Trophy Points:
    0
    #4
    You sure did! Thought I had the wrong template. :)

    I think the easiest way is to set an initial child category ($pcat = 4;). I can't see your template so this is based on the original.
    
    <?php 
       $pcat = 4;   // this sets an initial child category
       $category = sf_get_category_id(get_option('sf_portfolio_category'));
       $categories = get_categories('child_of='.$category);
    
    Code (markup):
    Also, you can get rid of the "Select a Category" menu by unchecking "Subcategory Navigation" in the theme options.

    Hope that works!
     
    Cash Nebula, Aug 15, 2010 IP
    radiant_luv likes this.
  5. radiant_luv

    radiant_luv Peon

    Messages:
    1,327
    Likes Received:
    34
    Best Answers:
    1
    Trophy Points:
    0
    #5
    Woo Hoo! That seems to be working. Thanks "Cash Nebula", I really appreciate your time and help. +1 rep to you.

    I need the subcategory to show as an breadcrumb on portfolio page as it will have "Web" "Logo" "Archive" "Template"
     
    radiant_luv, Aug 16, 2010 IP
  6. Cash Nebula

    Cash Nebula Peon

    Messages:
    1,197
    Likes Received:
    67
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Cheers! :D I like the changes you have made, especially the site slider. Simplefolio doesn't look so boring now! :cool:
     
    Cash Nebula, Aug 17, 2010 IP
  7. radiant_luv

    radiant_luv Peon

    Messages:
    1,327
    Likes Received:
    34
    Best Answers:
    1
    Trophy Points:
    0
    #7
    Hmm, not really. It's really embarrising now :eek: , it's not dynammic [will not get update as I post new project at portfolio]. Though I wanted this dynamic but I din't have enough time to experimenting around, it would have taken long time and I am a newbie when it comes to wordpress. Right now, the content on Home page including Slider is kinda static. But for now it serve my purpose. If I get time I will try explore this as well.

    Thanks
     
    radiant_luv, Aug 17, 2010 IP
  8. radiant_luv

    radiant_luv Peon

    Messages:
    1,327
    Likes Received:
    34
    Best Answers:
    1
    Trophy Points:
    0
    #8
    I am not creating another thread as it is again a category related question.

    When we are on this page "portfolio" the url at address bar is http://inspirationsunlimited.co.in/portfolio (Looks Good) however when I click on any of the category, for example "Logo" the URL at address bar changes to http://inspirationsunlimited.co.in/portfolio?pcat=32

    pcat=32 part looks ugly.

    I tried to change using Permalink to set as "/%category%/%pcat%/%postname%" but that's not working.

    Appriciate your help to pointing me to the right direction.

    Thanks
     
    radiant_luv, Aug 17, 2010 IP
  9. Cash Nebula

    Cash Nebula Peon

    Messages:
    1,197
    Likes Received:
    67
    Best Answers:
    0
    Trophy Points:
    0
    #9
    Yeah, that permalink doesn't work because Wordpress doesn't recognize %pcat% as a structural tag. This page lists all the tags you can use.

    There is a custom function in functions.php that creates the links, called sf_list_portfolio_child_categories.
    I think it can handle permalinks but it may tagged something on the end of them. Try it out and tell me what you see.
     
    Cash Nebula, Aug 17, 2010 IP
  10. radiant_luv

    radiant_luv Peon

    Messages:
    1,327
    Likes Received:
    34
    Best Answers:
    1
    Trophy Points:
    0
    #10
    Thanks Cash Nebula.

    From the link you posted, this part seems to has the asnwer to my query:
    %category%
    A sanitized version of the category name (category slug field on New/Edit Category panel). Nested sub-categories appear as nested directories in the URI. Starting Permalinks with %category% is strongly not recommended for performance reasons.

    However, that's not really happening. I did have a check on categories section and yes sub-cats are filled with slugs.

    Anything I have been missing, anyy quick thought?
     
    radiant_luv, Aug 18, 2010 IP
  11. Cash Nebula

    Cash Nebula Peon

    Messages:
    1,197
    Likes Received:
    67
    Best Answers:
    0
    Trophy Points:
    0
    #11
    Yeah, it's because "pcat=" is coded into the function that makes the links. I have tried to make it use the permalinks, but I really don't know how it will turn out. :eek:

    Make a backup copy of functions.php, then replace the sf_list_portfolio_child_categories function with this:
    function sf_list_portfolio_child_categories($topcat,$active,$pagepermalink) {
       $categories = get_categories('child_of='.$topcat);
       $array2 = array();
       foreach($categories as $k) {
          $array2[$k->term_id] = $k->name;
       }
       foreach ($array2 as $x => $y) {
          if ($x == $active) { $addtoclass = " class=\"active\""; }
          echo "<li".$addtoclass."><a href=\"".get_permalink($x)."\">".$y."</a></li>";
          unset($addtoclass);
       }
    }
    
    Code (markup):
     
    Cash Nebula, Aug 19, 2010 IP
  12. radiant_luv

    radiant_luv Peon

    Messages:
    1,327
    Likes Received:
    34
    Best Answers:
    1
    Trophy Points:
    0
    #12
    Thanks but that seems to be not working. Link does't work, If I'm on Portfolio page and I hover on any child categoeries, the url at status bar remain same. :(
     
    radiant_luv, Aug 19, 2010 IP
  13. Cash Nebula

    Cash Nebula Peon

    Messages:
    1,197
    Likes Received:
    67
    Best Answers:
    0
    Trophy Points:
    0
    #13
    Doh! :eek: get_permalink() is acting on the portfolio page each time so that is useless.

    This shows the links but they go to category lists instead of the portfolio page:
    echo "<li".$addtoclass."><a href=\"".$y."\">".$y."</a></li>";

    The links need pcat on the end because its the portfolio page that lists the posts, so they can't point anywhere else.
    I don't know how to get around that, apart from creating a separate page for each category or using some htaccess trick.
    Sorry I can't fix that, I'll PM you if I think of anything.
     
    Last edited: Aug 20, 2010
    Cash Nebula, Aug 20, 2010 IP
  14. radiant_luv

    radiant_luv Peon

    Messages:
    1,327
    Likes Received:
    34
    Best Answers:
    1
    Trophy Points:
    0
    #14
    That's okay. I really appriciate your time and effort to sort the things for me. This issue i will be keeping in the list and meantime i will try to sort other issues. I have been learning a lot. Thanks to all web community users who have been sharing tips and their knowledge.
     
    radiant_luv, Aug 21, 2010 IP