Custom taxonomies, and pullout byline

General questions pertaining to how certain issues can be resolved
Forum rules
1. No offensive language and no mocking
2. Please do a thorough search before you post something. Trust us, there is a high probability that the question you are asking has been asked previously.
3. No soliciting. You cannot post here soliciting bids for people offer you quotes, or even offer money to people for some work. You will be moderated if you do so. If you are looking for help, please post your request on http://jobs.wordpress.net or http://codepoet.com
4. Please be reasonable. You are getting software and support. For free. Complicated requests from a general purpose theme are not welcome and some volunteers might lose patience with you.
5. Please do your due diligence. If you posted a query and we answered with a link, take the trouble to go through the link contents.
6. Please post with complete information. Requests for help MUST be accompanied with your URL, particularly if you are asking something like "Why am I seeing a blank space?"

Custom taxonomies, and pullout byline

Postby Lexender » 06 Nov 2011, 12:06

Hi,

I've tried searching the forum for instructions on how to use taxonomies, but can't find any decent answer. I'm trying to use custom taxonomies, and I don't understand, after creating one, how to use it in any way. I can see it under the "post" menu in the dashboard, but it doesn't seem to do anything on the blog.

My ultimate goal would be to create an "author" taxonomy and have it shown in the pullout byline; I'm publishing posts by many different authors (short stories, poems and such, actually). How should I proceed? I am in no way an expert, and am quite afraid of php. I can't seem to find anything about my new taxonomy in either stylesheets or the suffusion options.

Here's hoping someone can help me.
Lexender
 
Posts: 5
Joined: 06 Nov 2011, 11:45

Re: Custom taxonomies, and pullout byline

Postby timc » 11 Nov 2011, 15:21

Hi Lexender,

I've been working with custom types and custom taxonomies in recent days also. I detect that we have similar needs. WIthout other interventions I observe that:
1. Custom taxonomies that have been applied to posts are not automatically displayed in the posts in the way that tags or categories are. Just as you wrote.
2. Custom types generally display like pages (as opposed to posts). No applied taxonomies are visible.

This is what I did in my child theme:
A. In the Suffusion settings, added my custom type and a number of taxonomies associated with that custom type only, followed by a couple of test entries of that type.
B. I used the instructions at http://bajada.net/2010/08/06/how-to-lis ... -and-terms, adding the functions to functions.php in my child theme (within the PHP tags). For me this was not a simple copy and paste from that page, so be careful (but then I was using IE7).
C. Copied single.php from the suffusion theme directory to my custom theme directory and renamed it single-customtype.php, where you should replace customtype with the type you defined at A.
D. Into single-customtype.php added the call from the site above at a suitable position. In my case that was after the main content, i.e.
after: <?php suffusion_content(); ?>
enter:
Code: Select all
<?php ucc_get_terms_list(); ?>

before: </div><!--/entry -->

Now on a single page for an entry of the custom type I created I see a UL list of custom taxonomies at the bottom of the entry. Each taxonomy entry in the list is clickable and gives me a page of entries for matching entries.

I can't be sure that this is an elegant method, this being my first excursion into PHP, but it seems to work for me today.

I have some work left to do, including: in a view of entry excerpts for a custom taxonomy, add a heading to indicate the taxonomy of the entries below.

I'd share the site, but it's in development. Hope you find the description useful.

Tim.
timc
 
Posts: 6
Joined: 11 Nov 2011, 04:36

Re: Custom taxonomies, and pullout byline

Postby sayontan » 11 Nov 2011, 17:00

@Timc,
What you have posted is more or less an accurate way to do things. The main challenge with supporting custom positioning or display of taxonomies with a custom post type is that I have no idea what the taxonomies are upfront.

I will add some functionality supporting this in the 4.x releases, but for now hand-coding things in the manner you have stated is the easiest way to do things.
Sayontan Sinha | http://mynethome.net/blog | http://www.aquoid.com/news
I don't do freelance work (for Suffusion or otherwise), so please don't contact me for quotes or offers.
sayontan
Site Admin
 
Posts: 10159
Joined: 15 Sep 2009, 16:39
Location: Houston, Texas

Re: Custom taxonomies, and pullout byline

Postby Lexender » 22 Nov 2011, 18:54

Wow, I thought this thread was lost in the oblivion of the forum archives. Thanks a bunch guys!

So, timc, yes, our problem is the same. I have tried following your tip, but as I don't know much about php, I didn't get far. But it inspired me, and after a -lot- of experimenting (mostly trial and error), I managed to solve the problem! (see lepied.littfra.com for result, under any category (it's in french)) The code is probably very ugly for someone who knows what they're doing, but it works fine for me, let me share it:

I edited pullout.php, and added, right after the call for tags, this code:
Code: Select all
if ($post_show_tags != 'hide') {
   $auteur = get_the_terms($post->ID, $auteur);
   if ($tags != '') {
      echo "<li><span class=''><span class='icon'>&nbsp;</span>";
      the_terms( $post->ID, 'auteur');
      echo "</span></li>\n";


It is obviously a pasted and modified version of the code for displaying tags. Now it works quite well, so yeah, good. Except it seems a little bit buggish. I think I understand the problem, but I'll be damned if I know how to solve them.

1-If a post is not tagged, the following taxonomies won't display. I suppose the code tells Wordpress not to display a tag if there is none available, hence also hiding other taxonomies labelled here as tags. Also, the "cheat" seems only to work under the "if ($post_show_tags != 'hide')" header for, I believe, aproximately the same reason.
2-Clicking on a taxonomy leads me to a page of taxonomies, as excepted, but showing the whole posts. I'd rather have only excerpts, but there is no setting to this effect in the suffusion options.
3-(un)Relatedly, I'd like to let all my "pages of X" (tags, cats, tax., etc.) show more than 10 posts. Ideally, to show all posts. How should I proceed?

And, if you're feeling generous, how should I proceed to make "index" pages, showing alphabetically all tags, or categories, or taxonomies, or post titles, without any excerpt?

Thanks for the help.
Lexender
 
Posts: 5
Joined: 06 Nov 2011, 11:45

Re: Custom taxonomies, and pullout byline

Postby timc » 23 Nov 2011, 06:33

I suspect the answers to your questions are:

1. You are right that your code will only display your custom terms if there are tags because that is what you have coded. Adjust your code to instead check whether any custom terms exist and display them if they do - your second IF. (I don't have the experience to re-write your code.)

2. A list of posts with a particular taxonomy will by default display excerpts or full content (etc.) as defined in the Suffusion settings for the front page, that is at Other Graphical Elements > Front Page settings > Layout Settings for the Front Page. (For display by categories, tags, authors, dates, Suffusion offers other custom settings.)

3. The restriction to 10 posts per view is in the main Wordpress settings under Settings > Reading.
timc
 
Posts: 6
Joined: 11 Nov 2011, 04:36

Re: Custom taxonomies, and pullout byline

Postby Lexender » 24 Nov 2011, 06:57

timc, you're great.

Is it also possible to display a description of the taxonomy?
Lexender
 
Posts: 5
Joined: 06 Nov 2011, 11:45

Re: Custom taxonomies, and pullout byline

Postby timc » 28 Nov 2011, 14:58

I found that it was possible to display a description of the taxonomy, and I hope this basic offering is in reasonable shape. As before, this is something I hoped to achieve for my own case, though the site is still in development so I can't share a URL.

I found that the function suffusion_template_specific_header in actions.php controls the presentation of a H2 heading for the category, tag, author and search views, as well as some supplementary information.

In that function I added a new IF to the series to cater for custom terms:
Code: Select all
   else if (is_tax() && ($suf_cat_info_enabled == 'enabled')) { ?>
      <div class="info-category fix">
         <h2 class="category-title"><?php echo wp_title('',  true, ''); ?></h2>
      </div><!-- .info-taxonomy -->
<?php
   }

This adds an H2 heading for the custom term if the category heading is set in the Suffusion options (template settings pages) to appear (which suits me) and with the same formatting as the category class (which also suits me). You could define the classes for the taxonomy. It just adds the wp_title heading, but that met my needs for now.

Of course, to guard against theme updates I added the entire adjusted function to my child theme's functions.php, that is all of function suffusion_template_specific_header() with the extra IF (above). I renamed the function child_suffusion_template_specific_header() and added a new function to replace the original function, in accordance with the instructions at http://aquoid.com/forum/viewtopic.php?f=4&t=3070 and http://aquoid.com/forum/viewtopic.php?f=4&t=5595&p=23133&hilit=race#p23133.

So now my child theme's functions.php includes:
Code: Select all
add_action("after_setup_theme", "child_theme_setup", 11);

function child_theme_setup() {
remove_action('suffusion_after_begin_content', 'suffusion_template_specific_header');
add_action('suffusion_after_begin_content', 'child_suffusion_template_specific_header');
}

// Adapted from theme default. Just the taxonomy IF added.
function child_suffusion_template_specific_header() {
// and more follows, including the extra IF.

Above I changed my custom theme name to 'child'.

I think this is working for me. Perhaps it will be useful.
timc
 
Posts: 6
Joined: 11 Nov 2011, 04:36


Return to Support Requests

Who is online

Users browsing this forum: Bing [Bot], Erroharadalia, Google [Bot] and 6 guests