Forum Replies Created

Viewing 13 replies - 76 through 88 (of 88 total)
  • Thread Starter iftomkins

    (@iftomkins)

    Great news!

    Thread Starter iftomkins

    (@iftomkins)

    Yes! You are correct. With the two above parameter changes, just de-selecting all the children of the subtopics in the widget configuration, with the subtopics selected, allows for just the list of subtopics.

    However, because I decided to customize and show the list of subtopics only on certain pages conditionally, I’m using the following code inside of a widget. The code was taken from here http://codex.wordpress.org/Template_Tags/wp_list_categories#Display_Terms_in_a_custom_taxonomy

    <?php
    
    $taxonomy     = 'topics';
    $orderby      = 'name';
    $depth        = '1';
    $show_count   = 0;      // 1 for yes, 0 for no
    $pad_counts   = 0;      // 1 for yes, 0 for no
    $hierarchical = 1;      // 1 for yes, 0 for no
    $title        = 'Topics';
    
    $args= array(
      'taxonomy'     => $taxonomy,
      'depth'        => $depth,
      'orderby'      => $orderby,
      'show_count'   => $show_count,
      'pad_counts'   => $pad_counts,
      'hierarchical' => $hierarchical,
      'title_li'     => $title
    );
    ?>
    
    <?php
    
    wp_list_categories( $args );
    
    ?>

    Thanks again for your plugin! 🙂

    Thread Starter iftomkins

    (@iftomkins)

    Hi!

    To answer your questions: 1. It’s not that I don’t want to show the hierarchy itself, it’s just that sometimes I only want to show the children of a parent taxonomy, and making the hierarchy parameter = ‘0’ seems to display only the children. 2. Yes, I would like to be able to hide the title of the taxonomy. Here is an illustrative example:

    Before: I had a hierarchical custom taxonomy like this (by default, the plugin shows all of the below):
    -Topics
    –Subtopic
    —Child of Subtopic
    —Child of Subtopic
    —Child of Subtopic

    Goal: My goal was to show only the Children of a single Subtopic, so it looks like this:

    -Child of Subtopic
    -Child of Subtopic
    -Child of Subtopic

    Changing this line
    'title_li' => $custom_taxonomy->labels->name, // Tax nice name
    to this line
    'title_li' => '',

    results in this:

    -Subtopic
    –Child of Subtopic
    –Child of Subtopic
    –Child of Subtopic

    Then, adding this line
    'hierarchical' => '0',
    results in this:

    -Child of Subtopic
    -Child of Subtopic
    -Child of Subtopic

    Success!

    Future Goal: I would also like, in a different location, to display only the Subtopics, but not their children, so it would look like this:

    -Subtopic
    -Subtopic
    -Subtopic

    I think I could get your plugin to do this, but I’m not sure how to configure the plugin to run differently in two different instances of the widget (since I still want to display only the Children of Subtopics in a couple other places). So I’m exploring a direct solution in the Codex. If you have any tips on how I could make the plugin run by one set of parameters in one widget instance and by another set of parameters in another, do let me know! 🙂

    Thread Starter iftomkins

    (@iftomkins)

    Found a solution to only display items contained within a given hierarchical taxonomy, while hiding the taxonomy titles and hierarchy. (Perhaps this could be a future addition to the widget setup?)

    At line 156,

    I added this line:
    'hierarchical' => '0',
    And changed this line
    'title_li' => $custom_taxonomy->labels->name, // Tax nice name
    to this line
    'title_li' => '',

    Here’s the entire chunk of code before and after.

    Before:

    $args_list = array(
    'taxonomy' => $custom_taxonomy->name, // Registered tax name
    'title_li' => $custom_taxonomy->labels->name, // Tax nice name
    'include' => implode(',', (array)$instance['include_' . $custom_taxonomy->name]),
    'orderby' => $instance['orderby'],
    'show_count' => $instance['show_count'],
    'order' => $instance['order'],
    'echo' => '0'
    );

    After:

    $args_list = array(
    'taxonomy' => $custom_taxonomy->name, // Registered tax name
    'title_li' => '',
    'hierarchical' => '0',
    'include' => implode(',', (array)$instance['include_' . $custom_taxonomy->name]),
    'orderby' => $instance['orderby'],
     'show_count' => $instance['show_count'],
    'order' => $instance['order'],
    'echo' => '0'
     );

    *All the parameters to the wp_list_categories function (which is what I changed) are listed here: http://codex.wordpress.org/Template_Tags/wp_list_categories

    Thread Starter iftomkins

    (@iftomkins)

    @mtwelve – Great idea! Since I lasted posted here I actually did the exact same thing, and edited the plugin PHP file directly, hard-coding our choice of header to parse, I suppose. Working fine for me, too, now.

    Yes, I agree. I’d find this feature very useful as well. I’m trying to display a taxonomy with only the top-level categories in one location, and then in another location display only a sub-category of the taxonomy and its terms, but not other subcategories.

    @ruben – thanks, and i look forward to the next version!

    @gryus – I modified and used your code. Thanks so much.

    I also changed it a little to add hyperlinks. Now each glossary word on the glossary page is a link. When you click the link, it searches the website for all pages containing that word. It’s not a direct link to the word’s location, but it’s a quick fix. This is the section of code, modified from your code above:

    <dl class="glossary">
    		<?php
    		// Output terms
    		$slt_currentLetter = "";
    		foreach ( $slt_glossary as $slt_glossaryTerm ) {
    			$slt_firstLetter = strtoupper( substr( $slt_glossaryTerm->word, 0, 1 ) );
    			echo '<dt';
    			if ( $slt_firstLetter != $slt_currentLetter ) {
    				echo ' id="letter-' . $slt_firstLetter . '"';
    				$slt_currentLetter = $slt_firstLetter;
    			}
    			echo '><a href="/?s=' . $slt_glossaryTerm->word . '">' . $slt_glossaryTerm->word . '</a></dt>';
    			echo '<dd>' . $slt_glossaryTerm->explanation . '</dd>';
    		}
    		?>
    	</dl>

    🙂 Alan

    Thread Starter iftomkins

    (@iftomkins)

    Mike,

    Works perfectly. Thanks so much!

    Cheers,
    Alan

    Thread Starter iftomkins

    (@iftomkins)

    One more thing. The widget settings keeps being reset to “Menu” and H2. I’m not sure why. I’m only using the Michael Fields Taxonomy Widget and the Grouped Links widget in addition. What do you think?

    Thanks!
    Alan

    Hi s_ruben!

    Great plugin. I love it. There are two things that would make it perfect for me.

    1) I’m with @bianca, an option to view all glossary entries would be amazing. This would be very useful if your glossary only has 20 words in it.

    2) Links from the Glossary Term (on the site’s glossary page) to the pages/posts in which that term appears. There are probably fancy ways to do it. But an easy solution would be to use the WordPress search feature. So for the glossary term “Gross Domestic Product”, it would link to http://www.website.com/?s=gross+domestic+product, which will then show all of the posts/pages where the term appears. And to make it even better, if there is only one search result, then the link could go directly to that page, and maybe even highlight the glossary term so the user can find it. (Whoa! That got intense real fast.)

    Again, great plugin, thank you so much! If you could post on this thread if you release a new version, I’d be even more appreciative. 🙂

    Best,
    Alan

    Thread Starter iftomkins

    (@iftomkins)

    Oops! Try that again:

    Great Plugin! It’s just what I needed. I might choose to plop the widget at the top of each page, even.

    The one thing that is challenging is the fact that it skips headers that have <a> tags within them. I know that this is known. The only challenge is that I’m using another plugin, Table of Contents Creator, and in order for certain headers to show up in the Table of Contents, I have to put <a> tags inside of the header tags. But if I do that then the header doesn’t show up in the Section Index. Oh no! Catch 22.

    Any thoughts? Would it be possible to enable the plugin to just ignore <a> tags that are within headers?

    :)! Thanks much.

    http://wordpress.org/extend/plugins/wp-section-index/

    I’m with @ragulka–I would also be very excited to be able to choose to show only the children of a given taxonomy.

    Thanks so much for the plugin, Michael, and loved your talk at WordCamp Portland!

    I would also be very excited for the ability to choose to show only the children of a given taxonomy! Thanks so much for the plugin, Michael, and loved your talk at WordCamp Portland.

Viewing 13 replies - 76 through 88 (of 88 total)