categories

Magento 1.7:Show category image on category page in full width in a 2 column template

佐手、 提交于 2019-12-07 16:36:07
问题 Can't find a solution for this issue running Magento 1.7. The category shown above in the main column. I want to show it above both columns, on page width. Here is an example: http://www.vimodos.nl/schoenen?art_sex=92 Anyone with a solution? Your reply is much appreciated! UPDATE Thanks for the reply. I followed your instructions and added a block called category.image in the catalog.xml <reference name="content"> <block type="catalog/category_view" name="category.products" template="catalog

Exclude Category From wp_get_archives?

不打扰是莪最后的温柔 提交于 2019-12-07 15:48:34
问题 Is there any way to exclude a category from wp_get_archives? I'm trying to show the months in the sidebar, but I want to exclude the posts that are not blog entries. $catID = get_cat_id('Projects'); $variable = wp_get_archives('type=monthly&show_post_count=1); echo $variable; 回答1: Use this if you want to include only specific categories for wp_get_archive function in your functions.php of your theme directory add_filter( 'getarchives_where', 'customarchives_where' ); add_filter( 'getarchives

Wordpress: get_the_category and echo out link to child-most/deepest category

ぐ巨炮叔叔 提交于 2019-12-07 15:48:30
问题 I have this code which is located on the search.php page and retrieves all the categories for each post and echo's out a link to the first category: $category = get_the_category(); //print_r($category); if ($category) { echo '<a href="' . get_category_link( $category[0]->term_id ) . '" title="' . sprintf( __( "View all posts in %s" ), $category[0]->name ) . '" ' . '>' . $category[0]->name.'</a> '; What I need to do is use a similar code but that gets the child-most/deepest category in the

Many-to-Many Hierarchy with Multiple Parents - PHP, MySQL

扶醉桌前 提交于 2019-12-07 12:01:33
问题 I'm trying to create a list of technology books by category, where each book can belong to more than one category, and each category can be both a parent category and a sub-category. Here's an illustration: JavaScript JavaScript Patterns Object-Oriented JavaScript Ajax Ajax Definitive Guide Bulletproof Ajax jQuery Learning jQuery 1.3 PHP jQuery Cookbook PHP PHP in a Nutshell PHP jQuery Cookbook Ajax Ajax Definitive Guide Bulletproof Ajax XML XML Hacks No-Nonsense XML -- As you can see... The

How do I call the original function from the overloaded function in a category?

六眼飞鱼酱① 提交于 2019-12-07 07:02:30
问题 In Objective-C, I have a category for a class: @interface UILabel(CustomInit) - (id)initWithCoder:(NSCoder *)coder; @end What I'm doing is writing a custom init function that does some extra stuff, and what I'd like to do, is in this custom init function, call the UILabel's base initWithCoder. Is this possible? How so? EDIT Thanks. Ok, so my plans moot. Can't just overload initWithCoder. Is there a way to achieve the same functionality (where all UILabels get this added initialization step)

Objective-C categories == visitor pattern?

瘦欲@ 提交于 2019-12-07 02:09:18
问题 Would you say that Objective-C categories are an implementation of the visitor design pattern? 回答1: No, Objective-C categories are not an implementation of the visitor pattern. Categories don't really have an exact match in the design pattern world, since the technique of injecting methods into existing classes without subclasses isn't possible in most languages. I'd say it's closer to the decorator pattern, but that pattern is usually implemented with composition, i.e. by wrapping an

Get Category name from Post ID

ε祈祈猫儿з 提交于 2019-12-06 18:28:02
问题 Is it possible to get the category name of a category given the Post ID, the following code works to get the Category Id, but how can I get the name? <?php $post_categories = wp_get_post_categories( 4 ); echo $post_categories[0]?> Thank! 回答1: here you go get_the_category( $post->ID ); will return the array of categories of that post you need to loop through the array $category_detail=get_the_category('4');//$post->ID foreach($category_detail as $cd){ echo $cd->cat_name; } get_the_category 回答2

Creating Wordpress Category at the time of Theme Activation

自古美人都是妖i 提交于 2019-12-06 16:09:33
I am going to create a function that will check whether if a Category named Testimonials is already available or not. If it is available do noting, whereas if it is not there, then create a new Category named Testimonials . I am using following code but nothing happened at the time of theme activation. What is missing? function create_my_cat () { if (file_exists (ABSPATH.'/wp-admin/includes/taxonomy.php')) { require_once (ABSPATH.'/wp-admin/includes/taxonomy.php'); if (!get_cat_ID('testimonials')) { wp_create_category('testimonials'); } } } add_action ('create_category', 'create_my_cat'); The

woocommerce display parent category thumbnail only (taxonomy-product_cat.php)

左心房为你撑大大i 提交于 2019-12-06 15:46:58
I created a function that display parent category thumbnails for all the pages that uses this template ( taxonomy-product_cat.php ) . The function is working on one of my parent and it's subcategories (category 1 with 6 subcategories), the problem is on the other category (category 2 with 6 subcategories) I created. It repeats the echo 6 times = equivalent to the number of it's subcategories. I don't know what's causing it. function woocommerce_get_parent_thumbnail() { global $post; $prod_terms = get_the_terms( $post->ID, 'product_cat' ); foreach ($prod_terms as $prod_term) { // gets product

Add a custom button for a specific product category in Woocommerce

懵懂的女人 提交于 2019-12-06 12:23:29
I want to display an additional button below the description to a specific product category: "bracelets" so I developed a piece of code, which does not work: add_action( 'woocommerce_single_product_summary', 'my_extra_button_on_product_page', 30 ); function my_extra_button_on_product_page() { if ( is_product_category('bracelets')) { global $product; echo '<a href="www.test.com">Extra Button</a>'; } } Any idea about what's wrong here? Your question is not really clear. 1) If you want to display a custom button for a specific product category on product category archives pages below the