Forum Replies Created

Viewing 10 replies - 1 through 10 (of 10 total)
  • Thread Starter caioxavier

    (@caioxavier)

    Is anyone else having problem with this or at least has idea what could be wrong?

    Thread Starter caioxavier

    (@caioxavier)

    <?php $wp_query->set('posts_per_page', 16);
     $wp_query->query($wp_query->query_vars); ?>
    
    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    <?php static $count = 0;
    if ($count == "16") { break; }
    else { ?>
    
    <div class="content-box">
    	<div class="thumbnail">
    		<a href="<?php the_permalink(); ?>"><?php the_post_thumbnail();	?></a>
    	</div>
    	<div class="textfield">
    	<a href="<?php the_permalink(); ?>"><h1><?php the_title(); ?></h1></a>
    
    	<h2>
    		<?php $parentscategory ="";
    			foreach((get_the_category()) as $category) {
    			if ($category->category_parent == 0) {
    			$parentscategory .= ' <a href="' . get_category_link($category->cat_ID) . '" title="' . $category->name . '">' . $category->name . '</a>, ';
    			}
    			}
    			echo substr($parentscategory,0,-2); ?>
    	</h2>
    	<?php the_excerpt(); ?>
    	</div>
    
    </div>
    
    <?php $count++; } ?>
    <?php endwhile; ?>
    <?php endif;
    wp_reset_query();?>

    get_the_excerpt() returns the excerpt, not the title of the post, so the title linking to the post is called by other function. You can also use the_excerpt() to display the excerpt directly inside <p></p> tags.

    You can use the_title() to call the title of the post, and it’s not going to be a link to the post unless you href it to the_permalink().

    So you can basically make:

    <a href="[your desired link]"><?php the_title(); ?></a>
    <?php the_excerpt(); >

    Don’t have to mention it has to be inside the loop, right?

    Forum: Hacks
    In reply to: Help with category page
    Thread Starter caioxavier

    (@caioxavier)

    Hey, anotherwpguy.

    Actually my search form is the most simple it can be.

    <form action=”http://www.dailyskateboarding.com&#8221; method=”get” accept-charset=”utf-8″ id=”searchform” role=”search”>
    <input type=”text” name=”s” id=”s” value=”Buscar…” onblur=”if(this.value==”) this.value=’Buscar…’;” onfocus=”if(this.value==’Buscar…’) this.value=”;” />
    <button onclick=”submit();”><img src=”http://www.dailyskateboarding.com/wp-content/themes/dailytheme/img/searchicon.png”/></button&gt;
    </form>

    In your case I think an advanced search plugin or some custom PHP could solve the problem, but as you can see I’m only beggining to learn PHP and just made my first website, so I’m afraid I won’t be of much help to you.

    Good luck!

    Forum: Hacks
    In reply to: Help with category page
    Thread Starter caioxavier

    (@caioxavier)

    Thank you for trying to help me.
    Unfortunately the code you provided didn’t work as expected. The childs are displayed in the parents category but not in the childs.

    I have solved using the if is_category() and wp_list_categories().

    If you want to see that in action so you can understand exactly what I was trying to achieve you can visit http://www.dailyskateboarding.com

    Thanks again for the help. This is the first website I make (I created the theme from scratch) and I feel I really need to learn solid PHP.

    I also need something like this and it’s surprisingly difficult to make it work in wordpress dinamically, without having to use a lot of conditionals or custom category templates.

    I created another topic asking for help, if you wanna check my situation: http://ww.wp.xz.cn/support/topic/help-with-category-page-2?replies=5

    Forum: Hacks
    In reply to: Help with category page
    Thread Starter caioxavier

    (@caioxavier)

    Well, I’ll try to explain more about the hierarchy I have. It’s pretty simple:

    I’m using the regular category.php template, and I would like to stick to that because that way the client can create a new category and the code would still work (if I can make it work…)

    I want the category page to display buttons to the child categories, that way you can filter the posts you get. So, if you are under “Category A”, which has 2 childs called “Child 1” and “Child 2” I would like it to display:

    [Category A] [Child 1] [Child 2]

    [posts loop]

    and the same if you are in Category B or Category C (with their own child categories)

    Using wp_list_categories(), I would have to customize based on category ID’s, which would make it impossible to use a single template (category.php) to list the right childs without using conditionals.

    I could solve this adding a bunch of templates or with a lot of conditionals, but I want to avoid that since the client would have to touch code in order to add a new category.

    Do you have it clearer now?

    Forum: Hacks
    In reply to: Help with category page
    Thread Starter caioxavier

    (@caioxavier)

    the problem is that I can’t make wp_list_categories display the info based on the current page. The way I found around it is to use conditional function is_category() to call a different wp_list_categories() based on current page ID.
    That way I have to make a condition to each category (parent and child). Is there a better way?

    Thank you cliepelt, I’m gonna check that.

    I have the same question. The hover style is terrible. I wanna change that.

Viewing 10 replies - 1 through 10 (of 10 total)