Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

 

Register GFY Rules Calendar
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
New Webmasters ask "How-To" questions here. This is where other fucking Webmasters help.

 
Thread Tools
Old 02-09-2013, 03:53 PM   #1
Tittytweaker
Confirmed User
 
Tittytweaker's Avatar
 
Industry Role:
Join Date: Dec 2012
Posts: 184
Code Help - displaying custom taxonomy?

Hi guys. I created a custom taxonomy called "Model". As you can see from my home page, I've basically been using the tags to organize by model, but I decided to switch over. Now I just need to swap the code for "tags" with the code for "model", so that it displays underneath all the little pictures, as well as on the gallery page itself where it says "tags".

Could someone take a look at my source code and tell me what exactly I need to change to accomplish this?

Thanks in advance,
~TT
__________________
www.tittytweaker.com
Tittytweaker is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook
Old 02-09-2013, 09:09 PM   #2
sarettah
see you later, I'm gone
 
Industry Role:
Join Date: Oct 2002
Posts: 14,057
It is probably just a change in your template, which we cannot see, we can only see the output from whatever script you are running.

.
__________________
All cookies cleared!
sarettah is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook
Old 02-09-2013, 11:17 PM   #3
kasun0777
Confirmed User
 
kasun0777's Avatar
 
Industry Role:
Join Date: Nov 2012
Location: Texas
Posts: 115
Quote:
Originally Posted by sarettah View Post
It is probably just a change in your template, which we cannot see, we can only see the output from whatever script you are running.

.
yeah. great answer
kasun0777 is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook
Old 02-09-2013, 11:51 PM   #4
Tittytweaker
Confirmed User
 
Tittytweaker's Avatar
 
Industry Role:
Join Date: Dec 2012
Posts: 184
http://www.adultsiteskins.com/

I'm using the first pink theme on there. Should be able to download it and see what I'm seeing.
__________________
www.tittytweaker.com
Tittytweaker is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook
Old 02-10-2013, 08:18 AM   #5
sarettah
see you later, I'm gone
 
Industry Role:
Join Date: Oct 2002
Posts: 14,057
Quote:
Originally Posted by Tittytweaker View Post
http://www.adultsiteskins.com/

I'm using the first pink theme on there. Should be able to download it and see what I'm seeing.

I hadn't noticed it was wp.

Ok, in 10 or 12 files in the theme folder you will find <?php the_tags('Tags: ', ', ', ''); ?>

Change that to <?php the_tags('Models: ', ', ', ''); ?>.

.
__________________
All cookies cleared!

Last edited by sarettah; 02-10-2013 at 08:30 AM..
sarettah is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook
Old 02-10-2013, 10:35 AM   #6
Tittytweaker
Confirmed User
 
Tittytweaker's Avatar
 
Industry Role:
Join Date: Dec 2012
Posts: 184
That only changes the tags so that it says Models. I have a separate taxonomy set up called Models, and I want that to display there. I plan on utilizing the tags in addition to the custom taxonomy, so that's not going to work.
__________________
www.tittytweaker.com
Tittytweaker is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook
Old 02-10-2013, 10:43 AM   #7
sarettah
see you later, I'm gone
 
Industry Role:
Join Date: Oct 2002
Posts: 14,057
Quote:
Originally Posted by Tittytweaker View Post
That only changes the tags so that it says Models. I have a separate taxonomy set up called Models, and I want that to display there. I plan on utilizing the tags in addition to the custom taxonomy, so that's not going to work.
Well to do that within wp will probably not be easy and would probably require a programmer.

I had read the original request that you were replacing the current tags with your new taxonomy so I figured you were putting your new taxonomy in place of the normal wp taxonomy.

It seems to me that if you know enough to figure out how to do a new taxonomy within the database then you should be able to figure out how to get it to print out but maybe not.

Anyway, without knowing your database structure on your new taxonomy I could not tell you anything about how to best implement it.

.
__________________
All cookies cleared!
sarettah is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook
Old 02-10-2013, 11:47 AM   #8
sarettah
see you later, I'm gone
 
Industry Role:
Join Date: Oct 2002
Posts: 14,057
Continuing a bit.

While I said above that I would not know without more info how best to implement it, and with a preface of "I am not a wp expert" I would reccomend:

That you keep your modifications within the theme rather than modifying out the wp core. That way you will not lose your changes each month when you upgrade wp.

So you would probably want to create a little library of your custom functions that deal with your new taxonomy then include it in the index.php (or archives, post, wherevere you are showing the new taxonomy) of your theme (wp-content/themes/yourtheme/index.php)

Like so:

<?php get_header(); ?>

<?php
// new taxonomy functions
include('newtaxonomy.php');
?>

Then wherever you are using it you would call your new function(s):

<span><?php the_tags('Tags: ', ', ', ''); ?></span>

<?php
// print new taxonomy here ??
echo my_new_taxonomy(get_the_ID(),arg2, arg3, arg4, etc);

?>

Hope that helps.


.
__________________
All cookies cleared!

Last edited by sarettah; 02-10-2013 at 11:57 AM..
sarettah is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook
Old 02-10-2013, 12:42 PM   #9
Tittytweaker
Confirmed User
 
Tittytweaker's Avatar
 
Industry Role:
Join Date: Dec 2012
Posts: 184
Yeah, unfortunately I really know nothing about wordpress, only as much as I can glean from tutorials and weave in with my limited html/css knowledge. It was easy to create the custom taxonomy, I just don't know how to actually implement the taxonomy the same way the tags are implemented.

Code:
/**
 * Add custom taxonomies
 *
 * Additional custom taxonomies can be defined here
 * http://codex.wordpress.org/Function_Reference/register_taxonomy
 */
function add_custom_taxonomies() {
	// Add new "Model" taxonomy to Posts
	register_taxonomy('model', 'post', array(
		// Hierarchical taxonomy (like categories)
		'hierarchical' => true,
		// This array of options controls the labels displayed in the WordPress Admin UI
		'labels' => array(
			'name' => _x( 'Model', 'taxonomy general name' ),
			'singular_name' => _x( 'Model', 'taxonomy singular name' ),
			'search_items' =>  __( 'Search Model' ),
			'all_items' => __( 'All Model' ),
			'parent_item' => __( 'Parent Model' ),
			'parent_item_colon' => __( 'Parent Model:' ),
			'edit_item' => __( 'Edit Model' ),
			'update_item' => __( 'Update Model' ),
			'add_new_item' => __( 'Add New Model' ),
			'new_item_name' => __( 'New Model Name' ),
			'menu_name' => __( 'Model' ),
		),
		// Control the slugs used for this taxonomy
		'rewrite' => array(
			'slug' => 'model', // This controls the base slug that will display before each term
			'with_front' => false, // Don't display the category base before "/model/"
			'hierarchical' => true // This will allow URL's like "/locations/boston/cambridge/"
		),
	));
}
add_action( 'init', 'add_custom_taxonomies', 0 );

?>
That right there is the actual chunk of code from my functions page. Is this all PHP code or something? That's something I'm entirely unfamiliar with.
__________________
www.tittytweaker.com
Tittytweaker is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook
Old 02-10-2013, 01:05 PM   #10
sarettah
see you later, I'm gone
 
Industry Role:
Join Date: Oct 2002
Posts: 14,057
Quote:
Originally Posted by Tittytweaker View Post
Yeah, unfortunately I really know nothing about wordpress, only as much as I can glean from tutorials and weave in with my limited html/css knowledge. It was easy to create the custom taxonomy, I just don't know how to actually implement the taxonomy the same way the tags are implemented.

.................

That right there is the actual chunk of code from my functions page. Is this all PHP code or
something? That's something I'm entirely unfamiliar with.
1. Yes that is php.

2. I did not know (as I said I am not a wp expert by any means) that they had a structured way to iintroduce a custom taxonomy. So you are doing it according to the book, that's good and probably better than the way I would have done it.

3. There should be information in the codex on how to use the custom taxonomy. I found a tutorial at http://net.tutsplus.com/tutorials/wo...om-taxonomies/ From what it says (and I am interpreting so my apologies if I do not have it right) you should be able to call your custom taxonomy thusly:

<?php

$model_list = get_the_term_list( $post->ID, 'model', '<strong>Model:</strong> ', ', ', '' );

// Output taxonomy information if there was any

if ( '' != $model_list ) {
echo $model_list;
} // endif

?>

Something like that.

Now all that depends on you getting your taxonomy definition right and having your terms defined for the various posts.

If you need additional help I would suggest you hit up Fris or someone like that who is well versed in wp.

Have fun.

.
__________________
All cookies cleared!

Last edited by sarettah; 02-10-2013 at 01:07 PM..
sarettah is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook
Old 02-11-2013, 12:08 AM   #11
Tittytweaker
Confirmed User
 
Tittytweaker's Avatar
 
Industry Role:
Join Date: Dec 2012
Posts: 184
Thanks for your help, seems to have done the trick.

Do you guys know how I would go about changing the template for that taxonomy? I have no idea where I'd go to edit that since creating a new taxonomy doesn't create an editable template in the theme, as far as I can tell. It seems if you make a new one it just pulls from a default template.

I'm doing my best to look these up for myself but since I'm for the most part unfamiliar with this I don't know what to look for specifically.
__________________
www.tittytweaker.com

Last edited by Tittytweaker; 02-11-2013 at 12:12 AM..
Tittytweaker is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook
Old 02-11-2013, 06:53 AM   #12
sarettah
see you later, I'm gone
 
Industry Role:
Join Date: Oct 2002
Posts: 14,057
Quote:
Originally Posted by Tittytweaker View Post
Thanks for your help, seems to have done the trick.

Do you guys know how I would go about changing the template for that taxonomy? I have no idea where I'd go to edit that since creating a new taxonomy doesn't create an editable template in the theme, as far as I can tell. It seems if you make a new one it just pulls from a default template.

I'm doing my best to look these up for myself but since I'm for the most part unfamiliar with this I don't know what to look for specifically.
I am not sure what you are asking there.

What I gave you above is the code you would add to your theme in various places where you want the taxonomy to print. You are looking for something else?

If you could be a touch more specific about what template you are referring to I might be able to find something.

Sorry for being dense, coffee is just hitting the system now.

;p

.
__________________
All cookies cleared!
sarettah is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook
Old 02-11-2013, 08:33 AM   #13
Tittytweaker
Confirmed User
 
Tittytweaker's Avatar
 
Industry Role:
Join Date: Dec 2012
Posts: 184
Basically, that code is just what makes it possible to display the taxonomy for that post, right? It's what outputs "Mode: Model Name".

Now when you click that model name, it takes you to a page with all the results for that model name. I'm trying to figure out how to edit that template, the same way one would edit the template for the category results page, or the tags results page.
__________________
www.tittytweaker.com
Tittytweaker is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook
Old 02-11-2013, 11:14 AM   #14
sarettah
see you later, I'm gone
 
Industry Role:
Join Date: Oct 2002
Posts: 14,057
Quote:
Originally Posted by Tittytweaker View Post
the same way one would edit the template for the category results page, or the tags results page.
That is the answer to your question. It is basically the same edit.

I took a look at your page and from what you have for Cristal Matthews I would say the edit for the page it goes to is pretty much the same. post->id is the post id and it appears that that is available on the page it goes to when you click.

Should be available on your gallery page too.

Search through all the .php pages in the theme for where it uses the tags code and you should be able to add your new code beneath it or in place of it.

.
__________________
All cookies cleared!
sarettah is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook
Old 02-11-2013, 11:28 AM   #15
Tittytweaker
Confirmed User
 
Tittytweaker's Avatar
 
Industry Role:
Join Date: Dec 2012
Posts: 184
No, that's not what I'm talking about. I'm not talking about the text underneath the photos anymore. I'm talking about the whole template for the whole page that clicking the model name takes you to. I can't edit that page because when you create a new taxonomy it doesn't add a new template for that page to the theme, therefore I can't edit anything for that page.
__________________
www.tittytweaker.com

Last edited by Tittytweaker; 02-11-2013 at 11:38 AM..
Tittytweaker is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook
Old 02-11-2013, 11:42 AM   #16
sarettah
see you later, I'm gone
 
Industry Role:
Join Date: Oct 2002
Posts: 14,057
Quote:
Originally Posted by Tittytweaker View Post
No, that's not what I'm talking about. I'm not talking about the code underneath the photos. I'm talking about the whole template for the whole page that clicking the model name takes you to. I have no clue how to edit that page because when you create a new taxonomy it doesn't add a new template for that page to the theme.
It is using an existing template. It did not invent anything new, I don't think ;p

I will take a glance and see if I can figure out which one. Probably category.php

In your category.php in your theme folder under this line:

<span><?php the_tags('Tags: ', ', ', ''); ?></span>

Put this:

<?php echo 'This is the category template'; ?>

then click through to the page in question and see if that line shows up. Depending on your font defaults and stuff you might have to do a view source to see it as it can end up black on black or white on white.

If it shows up, then it is the category.php file that you need to edit for that page. That is why I said to edit all occurrences throughout all the template files.

Let me know what happens please.


Edited in: I just went through the files in your theme, (yes, I actually downloaded it yesterday). The page template for that is either the category.php or the tag.php template files.

In the tag.php go and so the same edit as above but this one say <?php echo 'This is the tage page'; ?> and then click through and see if it says that on the page.

Those appear to be the only 2 templates in there that do not have the "related galleries" in them. Since the "related galleries" is NOT showing on the page I think it is one of them.

Hope that helps.

.
.
__________________
All cookies cleared!

Last edited by sarettah; 02-11-2013 at 11:56 AM..
sarettah is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook
Old 02-11-2013, 03:46 PM   #17
Tittytweaker
Confirmed User
 
Tittytweaker's Avatar
 
Industry Role:
Join Date: Dec 2012
Posts: 184
Ah! Found it. It was the archives template. I'd already changed the tags and category template so I wasn't sure what else there was to change. Thanks for your help, and for tolerating me! lol
__________________
www.tittytweaker.com
Tittytweaker is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook
Old 02-12-2013, 05:40 AM   #18
sarettah
see you later, I'm gone
 
Industry Role:
Join Date: Oct 2002
Posts: 14,057
Quote:
Originally Posted by Tittytweaker View Post
Ah! Found it. It was the archives template. I'd already changed the tags and category template so I wasn't sure what else there was to change. Thanks for your help, and for tolerating me! lol
Actually, that's funny because yesterday I had tried to edit the message I posted to say that it could be archives too. But the edit didn't take and I decided, nah, it ewouldn't be the archives template, doesn't make sense.

Glad you got it worked out.


.
__________________
All cookies cleared!
sarettah is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook
 
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.