Advanced link category functionality in Wordpress - wordpress

I've been fiddling around with Wordpress and I've realised that the links and link categories provide very little functionality.
For example, I want to display all the links in a certain link category in one page, and not any of the other links.
And in the remaining pages I want to display every link except those that have said category.
I can think of a dumb way of doing it, using a simple "Text Widget" and doing the list in HTML, but I was wondering if there was a smarter way. Like a way of being able to select which link categories I want displayed on a "Links" widget. A way to have several such widgets would also be great to divide the links among more than one sidebar.
Thanks in advance.

You can filter links based on the link category, so if you had a category foo you could get all links that were inside foo by using.
<?php wp_list_bookmarks('title_li=&categorize=0&category_name=foo' ); ?>
Foo can also be a varible, so you could figure out which page you were on and filter you list based on the title. In this case if I were on a post or page called bar the output would be all the links in the bar category.
<?php wp_list_bookmarks('title_li=&categorize=0&category_name='.$post->post_title ); ?>

Related

My new template file in WooCommerce doesn't work for products with tags

I am new with WooCommerce, and I don't know how to solve this issue. I have product with categories and tag.
In my home page I show two lists, product by tags and product by categories.
When I click in my first list I have to show something like this:
(return a list of this tag order by category)
Tag1
Category 1 (2) number of products
Category 2 (4)
Category 3 (1)
and when I click in Category 1, I show a product like product-tag.php file
For do this I override woocommerce plugin and add this in product-tag.php:
if (is_product_category()) :
include("product-category.php");
else:
if (is_product_tag()) :
include("listTag-product.php");
endif;
endif;
listTag-product.php is a new file that I created, but don't work, by default call to product-tag.php.
How to change this?
I want to use product_tag.php when I click in the list "Category 1 (2)" to show the product.
The problem is that a product tag can also be a product category or the opposite…
For that reason when using if (is_product_category()) the condition is always true and listTag-product.php will never be included…
Looking at WooCommerce templates, I don't see any:
product_tag.php template
product-category.php template…
The related existing WooCommerce templates are:
content-product_cat.php
taxonomy-product_cat
taxonomy-product_tag.php
After all why split this in 2 templates? You don't need that. You will better use the same template with fine tuned conditions inside it. But using conditionals as is_product_category() and is_product_tag() together is not the solution…
Depending on your thoughts, you could better use categories and subcategories instead of categories and tags.
If you want some real help, it will be better to reconsidering all, changing your approach and beginning to explore other ways. Here in Stackoverflow you will need to make a new question with more details and making available the code used in your templates or scripts, explaining with clarity, what is working and what not… For each problem one question at the time.
References:
Managing Product Categories, Tags and Attributes
Display WooCommerce Categories, Subcategories, and Products in Separate Lists

Category Tree View / Accordion on homepage- Magento 1.9

I want to have a 2 column layout with left bar on my homepage. In the left column, I want a list of categories shown in a tree view for a particular category of the main menu (Main menu has links like Contact Us etc which I do not want in the left tree view). I tried a number of solutions online, but nothing worked. Some of them listed the categories and subcategories, but without any CSS.
Anyone tried solving this?
There's no module that fit your needs, a little development should be done to retrieve the result you are looking for.
You could use the app/design/frontend/base/default/template/catalog/navigation/left.phtml block for this. In that block subcategories from the current category are shown, normally this block only is shown on listpages with subcategories.
You can add this block to the homepage and replace <?php $_categories = $this->getCurrentChildCategories() ?> with custom code which retrieves the categories/menu structure.

Wordpress: if category has NO children display single.php else display archive.php

As per the title,
I am using a accordion menu that displays my categories and sub categories.
If a category has any children i wish the results to be displayed using my modified archive.php. However if there are no children i wish for the post to be displayed on single.php.
many thanks in advance.
Simon
A while back I wrote a plugin called Category Template Hierarchy, it will easily let you accomplish what your trying to do by the fact that it lets you create templates specifically for templates that are parents.
It won't use archive.php, but it will allow you to create a template called parent-category.php. Anything that is not a parent will be ignored.
Additionally, the plugin gives you access to a conditional tag is_parent_category().

Page Template Custom Options

I have a little question. I am making a wordpress template that uses custom page templates. Now i ran into a problem. I want to create a page with a intro text and blog posts that come from a certain category. When a user creates a new page, I want them to be able to select the category from witch the posts are shown. Kinda like a drop down box with category's from where they can select the category they want. Does anyone maby knows a tutorial where I could learn how to do this ?
I mean something like this: http://imageshack.us/photo/my-images/10/naamloosea.jpg/
I already searched google but I could only find tutorials on how to make a template options page.
Thanks in advance,
Bob
You would want to create a Meta Box to save the category as a custom field entry within Pages. In here you could list the categories within a select box. You could then use this in the page template to pull in the posts from that category as you wish. I'll see if I can dig out a decent tutorial for this.
I did a quick search and found the following plugin for WordPress that may be of use... http://wordpress.org/extend/plugins/map-categories-to-pages/

Show remaining wordpress categories in drop down menu

I have limited space for horizontal category navigation bar on top of my theme and I need to limit number of categories shown on this bar and tell WordPress put "More.." as a drop down menu link at the end of the list to let users hover their mouse cursors on that to see other categories as shown in screenshot.
How can I do that?
Depends on what function you're using to format the navigation menu. It's probably wp_list_categories() which might not be the best choice in your case. As #Andre mentioned in his answer, you might want to go with navigation menus available since WordPress 3, but if you need to stick to categories, try get_categories() which will return the categories in a non-formatted way. This will enable you to loop through them in any way that you want, include a counter to limit the general output, and then loop through the rest under the More submenu.
Reference: get_categories
I guess you are using wordpress version 3+.
This is probably not the cleanest way but should work:
Register a custom menu to your template. Watch the 'depth' parameter (because you want the second level)
Go to 'Appearance - Menus'
Create a Custom Menu
Create a 'Custom Link' called 'More...'
add the 'More...' Link with the other categories as sub-categories to the menu.
write your CSS code to only display the second level on hover.
However, I'm not sure if you want the 'More..' menu item to be a linkpage/category. All of that is possible, just add the category/page instead of the 'Custom Link'.
Hope this workaround can solve your problem.

Resources