Search the Community
Showing results for tags 'categories'.
-
I have made a custom post type for products, and am using a custom taxonomy for the product categories. The thing that I am wondering about is that sometimes a product category is a parent, and sometimes a child, but sometimes both. For instance, if you have a top level category named shoes, then you might have a sub category named Nike. However, Nike also has shirts, so you could say that shoes and shirts were both subcategories of Nike. Do you know what I'm saying? It's like there is no real parent to child relationship, but they are both parents and both children of each other. How do you handle this type of situation?
-
I did not know which section I should publish this topic but I assumed it is PHP related. Any ideas from inspecting the code what kind of plugins this site is using to display the category posts as a gallery at the top? http://www.zillow.com/blog/ Any help would be greatly appreciated, Thanks,
- 1 reply
-
- wordpress
- categories
-
(and 1 more)
Tagged with:
-
Dear all, I have a script on my website's front page. Quickly summarized: - I have two main categories ("Made by me" and "Made by others") - I have five subcategories I want to have on my frontpage two columns (one for main category #1, two for main category #2) containing each two postings. I use two loops: <!-- Start the Loop. --> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <?php static $count = 0; if ($count == "2") { break; } else { ?> <?php if ( in_category('5') && !is_single() ) continue; ?> <!--Start Post--> <div align="justify" style='float:left; width: 276px; margin: 0 0 0 20px;'> <h6><a href="<?php the_permalink(); ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><div style="color: #000000;"><?php the_title(); ?></div></a></h6> <div style="font-size: 80%; color: #999999; font-style: italic; font-weight: bold;">In: <?php //exclude these from displaying $exclude = array("4"); //set up an empty categorystring $catagorystring = ''; //loop through the categories for this post foreach((get_the_category()) as $category) { //if not in the exclude array if (!in_array($category->cat_ID, $exclude)) { //add category with link to categorystring $catagorystring .= ''.$category->name.', '; } } //strip off last comma (and space) and display echo substr($catagorystring, 0, strrpos($catagorystring, ',')); ?></div> <?php $my_excerpt = get_the_excerpt(); echo "<div style=\"color: #000000;\">"; echo $my_excerpt; echo "</div>"; ?> <?php wp_link_pages(array('before' => '' . __('Pages:', 'cloriato'), 'after' => '')); ?> <div class="frontpage_olav"> <a class="read_more" href="<?php the_permalink(); ?>"></a></div> </div> <!--End Post--> <?php $count++; } ?> <?php endwhile; ?> <!--End Loop--> <?php endif; ?> </div> And for the second column: <!-- Start the Loop. --> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <?php static $count2 = 0; if ($count2 == "2") { break; } else { ?> <?php if ( in_category('4') && !is_single() ) continue; ?> <!--Start Post--> <div align="justify" style='float:left; width: 276px; margin: 0 0 0 17px;'> <h6><a href="<?php the_permalink(); ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><div style="color: #000000;"><?php the_title(); ?></div></a></h6> <div style="font-size: 80%; color: #999999; font-style: italic; font-weight: bold;">In: <?php //exclude these from displaying $exclude2 = array("5"); //set up an empty categorystring $catagorystring2 = ''; //loop through the categories for this post foreach((get_the_category()) as $category2) { //if not in the exclude array if (!in_array($category2->cat_ID, $exclude2)) { //add category with link to categorystring $catagorystring2 .= ''.$category2->name.', '; } } //strip off last comma (and space) and display echo substr($catagorystring2, 0, strrpos($catagorystring2, ',')); ?></div> <?php $my_excerpt2 = get_the_excerpt(); echo "<div style=\"color: #000000;\">"; echo $my_excerpt2; echo "</div>"; ?> <?php wp_link_pages(array('before' => '' . __('Pages:', 'cloriato'), 'after' => '')); ?> <div class="frontpage_olav"> <a class="read_more" href="<?php the_permalink(); ?>"></a></div> </div> <!--End Post--> <?php $count2++; } ?> <?php endwhile; ?> <!--End Loop--> <?php endif; ?> The whole problem is now that often the first column only shows one posting instead of two. Sometimes, however, it does show two postings. What am I doing wrong? Why doesn't it show two postings as it's supposed to do? How come my first column doesn't function properly? Thanks a lot for all your help! Olav
-
Hi everybody and congratulations for being part of this forum. Well the case is that being a beginner in this thing called php, I am looking for an elegant, functional way to detect active categories in a Joomla!-based site. The idea is to apply certain css rules to an entire site when certain categories are active. In fact, specific css styles for each active category. The administrator in charge of the site will not have any control over the css files and their implementation, so I have to leave the site prepared in terms of styling. The site will have a good number of categories to be activated and deactivated whenever the webmaster consider the opportunity. Do you know some approach to the problem? Some practical example or idea. Best regards.
-
Hello! This is my first time here and I'm not sure if this is where I should be posting this, but I want to delete all this info on a post: Date, Author, Categories, Bookmark permalink. How do I do that? Thank you! The website and post example is the following: http://www.emilykimballart.com/a-few-details/
- 2 replies
-
- posts info
- date
-
(and 2 more)
Tagged with:
-
Hi all! I'm working on a simple script to manage a webcomic, which will have multiple pages in each chapter. I'm trying to create an archive page which will show thumbnails for every comic, organized by chapter, such as: Chapter 1 Title - Page 1 - Page 2 - Page 3 Chapter 2 Title - Page 1 - Page 2 - Page 3 Etc In MySQL, I have two tables: Chapter (ChapterID, Name) Page (PageID, Chapter, Image, Thumbnail) The only method I could find for achieving this on Google suggested using a query to obtain all of the chapters from the chapter table, and then while looping through the results, use a second statement with a WHERE clause to select the comics for that chapter. However, that just seems like poor practice and sounds horribly inefficient once too many chapters are added. I'm wondering if there's a more efficient way to approach this, so that I can organize my results into groups? If someone could simply give me the logic to use or nudge me in the right direction, I'd gladly appreciate it Thanks, Joey
- 2 replies
-
- organization
- groups
-
(and 1 more)
Tagged with: