GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Webmaster Q & Fuckin' A (https://gfy.com/forumdisplay.php?f=27)
-   -   List of all Custom Taxonomy terms? (https://gfy.com/showthread.php?t=1100783)

Tittytweaker 02-21-2013 07:08 PM

List of all Custom Taxonomy terms?
 
I have a custom taxonomy called "Model" on my wordpress blog. I'd like to be able to create a functional "Browse by model" page on my site. I need to be able to just get a complete list of every term that is in that taxonomy and list it on one page. I've tried googling it, like always, but it's all Greek to me.

I'd like it to auto-update every time a new term is added, as well as have it listed alphabetically, with perhaps a column for every letter. Is there a plugin that can accomplish this?

Thanks in advance,
~TT

Miguel T 02-22-2013 08:10 PM

Code:

$terms = get_terms("my_taxonomy");
 $count = count($terms);
 if ( $count > 0 ){
    echo "<ul>";
    foreach ( $terms as $term ) {
      echo "<li>" . $term->name . "</li>";
       
    }
    echo "</ul>";
 }


Tittytweaker 02-22-2013 08:53 PM

Sorry, I guess I still don't get it. I saw this when Googling around trying to find an answer as well but never found a satisfying answer as to how to implement it.

What exactly am I supposed to do with this? I'm trying to get it on this page:

http://www.tittytweaker.com/browse-by-model/

But pasting it in there just shows the code, and not the list.

Kostly 02-23-2013 07:18 AM

Create a simple module or plugin or whatever word press calls it :)

Tittytweaker 02-23-2013 11:12 AM

Unfortunately I don't have the ability to do that, which is why I'm asking. I was hoping there was a way to do it with an existing plugin or chunk of code that way I don't have to go through and manually create hyperlinks for every term.

sarettah 02-23-2013 01:50 PM

You put what was posted above into php tags and then change your term name and it should work. (I think )

Quote:


<?php

$terms = get_terms("model");
$count = count($terms);
if ( $count > 0 ){
echo "<ul>";
foreach ( $terms as $term ) {
echo "<li>" . $term->name . "</li>";

}
echo "</ul>";
}

?>

Tittytweaker 02-23-2013 04:01 PM

Installed a plugin to enable PHP in the posts and pages called PHP Execution. I've got a list now, but is there any way to make them clickable?

sarettah 02-23-2013 04:43 PM

I think you do this, not sure if there is a better way.

Quote:

<?php

$terms = get_terms("model");
$count = count($terms);
if ( $count > 0 ){
echo "<ul>";
foreach ( $terms as $term ) {
echo '<li><a href="' . get_term_link($term) . '">'. $term->name . '</a></li>';

}
echo "</ul>";
}

?>

sarettah 02-23-2013 04:48 PM

Quote:

Originally Posted by Tittytweaker (Post 19497144)
Installed a plugin to enable PHP in the posts and pages called PHP Execution. I've got a list now, but is there any way to make them clickable?

You should not have had to install a plugin.

.


All times are GMT -7. The time now is 06:27 PM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc