Forums

Tag Dropdown (22 posts)

  1. paulsanduleac
    Member
    Posted 1 year ago #

    I need to create a dropdown list with tags in the header of the theme. Please help.

    The tutorial from WPHacks is giving me a blank page error.

  2. Mark / t31os
    Moderator
    Posted 1 year ago #

    Use wp_dropdown_categories(), it does support changing which taxonomy to select terms from.
    http://codex.wordpress.org/Template_Tags/wp_dropdown_categories

    Simply set the taxonomy to post_tag, and plonk in any other args/params you want.

    Or if you really want to see the WP hacks site tutorial, you can usually get round issues not being to see the page by using googles cache.

    webcache.googleusercontent.com/search?q=cache:lkxfsnu5tf4J:wphacks.com/how-to-display-wordpress-tags-dropdown-menu/

  3. paulsanduleac
    Member
    Posted 1 year ago #

    I can see the page from WpHacks, but when I implement it on my blog, it gives me a lot of errors when accessing the wp-admin area. Thanks, I'll try that.

  4. paulsanduleac
    Member
    Posted 1 year ago #

    How exactly do I change the taxonomy? You see, I'm using the tag dropdown list in the header of the template. I implemented the tutorial from WPHacks, and here are the errors I get after I press login on wp-login.php:

    Warning: Cannot modify header information - headers already sent by (output started at /home/content/11/5713411/html/CupciniCity/wp-content/themes/the-view-wp/functions.php:16) in /home/content/11/5713411/html/CupciniCity/wp-login.php on line 302
    
    Warning: Cannot modify header information - headers already sent by (output started at /home/content/11/5713411/html/CupciniCity/wp-content/themes/the-view-wp/functions.php:16) in /home/content/11/5713411/html/CupciniCity/wp-login.php on line 314
    
    Warning: Cannot modify header information - headers already sent by (output started at /home/content/11/5713411/html/CupciniCity/wp-content/themes/the-view-wp/functions.php:16) in /home/content/11/5713411/html/CupciniCity/wp-includes/pluggable.php on line 665
    
    Warning: Cannot modify header information - headers already sent by (output started at /home/content/11/5713411/html/CupciniCity/wp-content/themes/the-view-wp/functions.php:16) in /home/content/11/5713411/html/CupciniCity/wp-includes/pluggable.php on line 666
    
    Warning: Cannot modify header information - headers already sent by (output started at /home/content/11/5713411/html/CupciniCity/wp-content/themes/the-view-wp/functions.php:16) in /home/content/11/5713411/html/CupciniCity/wp-includes/pluggable.php on line 667
    
    Warning: Cannot modify header information - headers already sent by (output started at /home/content/11/5713411/html/CupciniCity/wp-content/themes/the-view-wp/functions.php:16) in /home/content/11/5713411/html/CupciniCity/wp-includes/pluggable.php on line 868
  5. Mark / t31os
    Moderator
    Posted 1 year ago #

    How exactly do I change the taxonomy?

    wp_dropdown_categories( array( 'taxonomy' => 'post_tag' ) );

    I implemented the tutorial from WPHacks, and here are the errors I get after I press login on wp-login.php:

    Sounds like an issue with placement of code. If you want help checking it's placed correctly, copy all the code of the file you pasted the wphack code into, and paste it into a pastebin, then provide the link back here please.

  6. paulsanduleac
    Member
    Posted 1 year ago #

    Here is what I have in my functions.php:
    http://wordpress.pastebin.com/DYbse2T5

    And my header.php:
    http://wordpress.pastebin.com/zVyHTMUV

    I've also tried copying this part:

    <div class="date-issue">
            September, 2009 <span class="issue">Edition #10</span>
    <select name="tag-dropdown" onchange="document.location.href=this.options[this.selectedIndex].value;">
            <option value="#">Select Edition</option>
            <?php dropdown_tag_cloud('number=0&order=asc'); ?>
    </select>
    </div>

    at the beginning of index.php but unfortunately the errors remain.
    Thank you for your help.

  7. Mark / t31os
    Moderator
    Posted 1 year ago #

    Copy and pasted the code for testing, seems to work just fine for me.

    Can you try with plugins disabled?

  8. paulsanduleac
    Member
    Posted 1 year ago #

    I have all the plugins disabled, on a clean wp install with just a couple posts.

    I get the error page after I press login on wp-login.php, did you try that?

  9. Mark / t31os
    Moderator
    Posted 1 year ago #

    Nope, but i've given it a shot (thinking you'd caught the issue)..

    Still works as expected.. i've also tried the 2.9 install, i've been testing the 3.0 install up until now.

    Still works ... :-s

    NOTE: I also have debugging on to, so i certainly can't see anything being wrong with the code..

    Additional note: Try removing the closing PHP tag from your functions file.. (don't worry it's not required for PHP files), ie. the last ?>

  10. paulsanduleac
    Member
    Posted 1 year ago #

    Still can't figure it out. Can we talk somewhere in private? (Like PM which does not exist here...)

  11. paulsanduleac
    Member
    Posted 1 year ago #

    Yeps!! I think everything works fine now. The problem was that I had a clean text line between 2 PHP sequences.
    Thanks.

  12. paulsanduleac
    Member
    Posted 1 year ago #

    I finished with one problem and now I have another one. Will the tag dropdown work if the content is first filtered by category?

  13. Mark / t31os
    Moderator
    Posted 1 year ago #

    It should do, what makes you think it wouldn't?

  14. paulsanduleac
    Member
    Posted 1 year ago #

    It does not for me. I have 3 columns of content on my page, each column divided in 3 boxes. Every box from every column shows a predefined category. Now, I have put the tag dropdown in the header and it does not work. When I change the tag in the list it does nothing...

  15. Mark / t31os
    Moderator
    Posted 1 year ago #

    Is it possible to provide a URL to a page with the problem?

  16. paulsanduleac
    Member
    Posted 1 year ago #

  17. Mark / t31os
    Moderator
    Posted 1 year ago #

    The content on the left side changes when selecting from the dropdown..

    Is each column pulling it's data from the same query or are they seperate queries?

  18. paulsanduleac
    Member
    Posted 1 year ago #

    When I try clicking, the content does not change at all, only the page refreshes. Try again and you will see.
    Each box is a separate query, so that I have about 7 queries on the page.

  19. Mark / t31os
    Moderator
    Posted 1 year ago #

    Can i see the code that handles outputing those posts, the category queries.

  20. paulsanduleac
    Member
    Posted 1 year ago #

    Could this be because of the large number of queries on the page?

  21. paulsanduleac
    Member
    Posted 1 year ago #

    Here is the code that I use for all of them, each one separately, only the category name changes: http://pastebin.com/Bfs9YNaH

  22. Mark / t31os
    Moderator
    Posted 1 year ago #

    There's nothing in those queries to accept the incoming tag queries..

    Perhaps something along these lines will help get you started,

    // New code
    $queried_tag = get_query_var( 'tag' ) ? get_query_var( 'tag' ) : '';
    $queried_tag = ( $queried_tag = '' ) ? '&tag='. $queried_tag : '' ;
    // Your code
    $lastposts = get_posts("numberposts=1&category_name=news$queried_tag");
    foreach($lastposts as $post) :
    
    .... etc (trimmed for example)

    Else your queries do nothing to with the queried for tag..

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags