Build Your Own Business Website header image

Welcome to our Members Only Forum

You are welcome to view the content on our Forum, just scroll down to view this forum post.
If you like what you find and want to be able to post a question, please check out our subscription options.
Please feel free to search the forum using either the Google Site Search above or the forum search below.

Avatar
Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

sp_Feed sp_TopicIcon
Different Image/Banner, per Category
Avatar
Ronen Laviv
Jedi
Members

Community Member
Forum Posts: 251
Member Since:
November 1, 2013
sp_UserOfflineSmall Offline
1
December 13, 2013 - 11:42 am
sp_Permalink sp_Print

Hi Rick,

 

Clicking on a specific category, takes you a the relevant category page, based on the custom skin.

I'm trying to have different pre-defined banner per category, so same page/skin should show different banners,

depending on the category that was used.

 

I was thinking of using php with a hook from the category featured column container on the skin editor.

I thought of using the slider plugin I already have, with short codes, and if else statemaents with different short codes depending on the actual category.

 

And.... the related questions:

1) Is there a simpler/better way than I described ? (Short codes, sliders, ...)

2) I tried capturing the current "category" I am, when the category page was chosen, but, the WP functions I used didn't work for me. I'd appreciate if you might have the time to advise with 3-4 lines skeleton of how to get the category I'm in and compare to my pre-defined ones, then show the right banner or short code. I'll take it from there 🙂

 

Thanks,

Ronen.

Avatar
Rick Anderson
Desert Hot Springs, CA
Admin
Forum Posts: 13637
Member Since:
November 8, 2009
sp_UserOfflineSmall Offline
2
December 14, 2013 - 7:29 am
sp_Permalink sp_Print

You don't need to use custom code for this.  

You can either create custom templates for your categories,

Or use a widget area and then use the slider's widget (or text widget with short code) and then use a plugin like Display Widgets (or Dynamic Widgets) to determine which archive pages those widgets should display on.

In the long run this will be much easier to implement and maintain.

Avatar
Ronen Laviv
Jedi
Members

Community Member
Forum Posts: 251
Member Since:
November 1, 2013
sp_UserOfflineSmall Offline
3
December 14, 2013 - 9:24 am
sp_Permalink sp_Print

I don't fully understand yet, you mentioned:

"You can ... create custom templates for your categories"

I have a custom template, but (and I may be missing your point here) , When a user clicks on a wordpress category, or does this from the excerpt, I do not know of a way to control what's shown per category. I'm not reffering to just links, that I can control and redirect to specific pages. I'm referring to WP built in system of categories.

I thought it was a wordpress infrastructure has a specific view for category (using the template "Categories").

 

You may be making a hidden assumption, that my knowledge limitation couldn't reveal...

 

Is there a way in WP to control the landing page per category "name" ?

 

Thanks,

R.

 

 

Avatar
Rick Anderson
Desert Hot Springs, CA
Admin
Forum Posts: 13637
Member Since:
November 8, 2009
sp_UserOfflineSmall Offline
4
December 14, 2013 - 12:19 pm
sp_Permalink sp_Print

Yes, those are called "Archive" pages.  By default in Agility all archive pages are the same, however you can customize the category template so that it displays what you want it to display.  So you have to start there.

Then if you want a specific category to display differently from the others you can create a custom template (generally starting with the category template as a base) and then choose that template for that category.

That is the information I assumed you already knew.  If you don't fully understand this then watch the seminar the Beginner's Guide to the Thesis 2.1 skin editor - especially the part about templates.

Avatar
Ronen Laviv
Jedi
Members

Community Member
Forum Posts: 251
Member Since:
November 1, 2013
sp_UserOfflineSmall Offline
5
December 14, 2013 - 12:25 pm
sp_Permalink sp_Print

will do. Thanks.

Avatar
Ronen Laviv
Jedi
Members

Community Member
Forum Posts: 251
Member Since:
November 1, 2013
sp_UserOfflineSmall Offline
6
December 14, 2013 - 1:54 pm
sp_Permalink sp_Print

I added a category, and found how to use the custom template on the category editing menu.

However, for example, clicking category is taking me to the default category template and NOT to my custom chosen one.

Is this the WP 3.8 issue you were warning about ?

Avatar
Rick Anderson
Desert Hot Springs, CA
Admin
Forum Posts: 13637
Member Since:
November 8, 2009
sp_UserOfflineSmall Offline
7
December 15, 2013 - 7:59 am
sp_Permalink sp_Print

Yes, it does appear to be a Thesis 2.1, WordPress 3.8 issue.

Avatar
Ronen Laviv
Jedi
Members

Community Member
Forum Posts: 251
Member Since:
November 1, 2013
sp_UserOfflineSmall Offline
8
December 15, 2013 - 8:09 am
sp_Permalink sp_Print

Thanks, I'll post on DIY forum then.

I'm not sure I want to do that, but,... would it be mission impossible to role back to WP 3.7 now ?

Avatar
Rick Anderson
Desert Hot Springs, CA
Admin
Forum Posts: 13637
Member Since:
November 8, 2009
sp_UserOfflineSmall Offline
9
December 15, 2013 - 8:12 am
sp_Permalink sp_Print

I've posted this as a bug report on the forum and on our dev chat site.  My guess is you will see the fix in the next day or so.  Unless this is urgent I would just wait.

Avatar
Ronen Laviv
Jedi
Members

Community Member
Forum Posts: 251
Member Since:
November 1, 2013
sp_UserOfflineSmall Offline
10
December 15, 2013 - 8:30 am
sp_Permalink sp_Print

just saw it now. already posted.

It's not so urgent that it can't wait a couple of days.

If they get back to me, I'll tell them you already posted this bug and there's no need to track it twice.

 

Thanks,

R.

Avatar
Ronen Laviv
Jedi
Members

Community Member
Forum Posts: 251
Member Since:
November 1, 2013
sp_UserOfflineSmall Offline
11
December 20, 2013 - 12:12 pm
sp_Permalink sp_Print

Now when WP3.8 problems are behind us, I got back to this again.

I have ~30 Categories.

I believe php would be a one time infrastructure, while any other solution would be harder to maintain.

I'll explain "why" (maybe you still think there are better ways), and then ask the "how":

I have 3 main parent categories.

Each Category has Children categories and some have sub-children categories.

What I need to do when someone clicks a category is to have a formatted text banner on a specific colored background.

In case of clicking on a sub sub category, the text banner should look something like:

-------------------------------------- Full width Container limits ------------------

Category 1 (Heading Size Text)

>Subcategory 1>Sub Sub Category 1

------------------------------------------------------------------------------------------

Now, I can make 30 of those templates, and each time I rename a category try to remember changing that, or,

Create a php script that extracts the categories automatically, so no maintenance.

I would need to extract:

A) What Category or Sub Category I am on.

B) Is the category is a grand child, a child or the parent ?

    Based on that, the first and second line of text should be formatted with the category names.

C) I'd like to control the text formatting (Color, Font, Size) per first line (Partent) and 2'nd line (Child/grandchild).

 

The guidance I wanted to ask was:

1) What function can extract category name ?

2) What function can check if category name has a parent and a grand parent ?

3) How to style output html text when using php ?

 

Any guidance would be appreciated.

 

Happy Holidays,

Ronen.

Avatar
Ronen Laviv
Jedi
Members

Community Member
Forum Posts: 251
Member Since:
November 1, 2013
sp_UserOfflineSmall Offline
12
December 20, 2013 - 3:50 pm
sp_Permalink sp_Print

ok...found it. please disregard my question.

 

In case other users are interested, this worked  for me:

 

function category_custom_banner_message() {
        $cur_category = get_category( get_query_var( 'cat' ) );
        $cur_cat_name = $cur_category->cat_name;
        $parent_id = $cur_category->category_parent; //category's parent ID
        $ancestors = get_category_parents($parent_id, false, ",");
        $ancestors = $ancestors . "$cur_cat_name";
        $cats = explode(",",$ancestors);
        $size = sizeof($cats);
        if ($size == 3) {
             $message = '<div class="category_title_c">' . $cats[0] .
                        '</div><div class="category_sub_title_c"> >' .$cats[1] . ' >' . $cats[2] . '</div>';
        } else {
             $message = '<div class="category_title_c">' . $cats[0] .
                        '</div><div class="category_sub_title_c"> >' .$cats[1] . '</div>';
        }
        echo $message;
}

It assumes maximum of 3 levels, minimum of two.

Avatar
Rick Anderson
Desert Hot Springs, CA
Admin
Forum Posts: 13637
Member Since:
November 8, 2009
sp_UserOfflineSmall Offline
13
December 24, 2013 - 10:16 am
sp_Permalink sp_Print

The whole cycling through category ancestry can be pretty complex.  I'm glad you worked it out.

This seems like it gives rise to the possibility of a new box - Display content by taxonomy where you select the controlling taxonomy and taxonomy term.

Forum Timezone: America/Los_Angeles

Most Users Ever Online: 228

Currently Online:
20 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

Keith W Jones: 1428

Brian Tozer: 1004

Carolin: 982

Heidi Hafner: 508

John Cunningham: 423

Reece Morrel: 353

Newest Members:

emma62755

sharonmarks

emma80233

Tijs de Jong

Daniel Frey

mutek

Forum Stats:

Groups: 8

Forums: 46

Topics: 6995

Posts: 34796

 

Member Stats:

Guest Posters: 6

Members: 6761

Moderators: 2

Admins: 2

Administrators: Rick Anderson, Rick Anderson

Moderators: Pierre Cote, Laura Nugent