meredith1986
Forum Replies Created
-
Ok, I think I just figured it out. All I had to do was move the title inside the entry-content div. Does this code look right?
<div class="booksSection"> <?php $args = array( 'post_type' => 'book', 'posts_per_page' => 3 ); $loop = new WP_Query( $args ); while ( $loop->have_posts() ) : $loop->the_post(); echo '<div class="entry-content">'; the_title(); the_content(); echo '</div>'; endwhile; ?> </div>
Sorry, I’m having a difficult time explaining what I’m trying to achieve.
I want my client to be able to go in and add new books from the Dashboard and I would like each one of those 3 divs to be separate books. I have created a custom post type called Books, but I don’t know what code to use on my custom page in order to display 3 of the latest Book posts, each in a separate div. The way I have it set up now (see my code from the first post), the Books posts are just being listed one after the other.
Does that make sense?
Or is there a better way altogether to achieve this?
Thanks Stacey, but that did not do the trick. The posts are not in categories, they are just custom post types.
I’m essentially trying to do something like this:
<div class="fourcol first pad-30"> <div class="involved-icon" style="background-image:url(images/adopt.png);"></div> <h3 class="serif light bigtext">Adopt an Orphanage</h3> <p>Support an orphanage and make an impact on an entire community.<br><br></p> <a class="uc" href="/get-involved/adopt-an-orphanage">Learn More</a> </div> <div class="fourcol pad-30"> <div class="involved-icon" style="background-image:url(images/campaign.png);"></div> <h3 class="serif light bigtext">Run Your Own Campaign</h3> <p>Invite your friends and neighbors to join the fight for orphans around the world.</p> <a class="uc" href="/get-involved/run-a-campaign">Learn More</a> </div> <div class="fourcol last pad-30"> <div class="involved-icon" style="background-image:url(images/visit.png);"></div> <h3 class="serif light bigtext">Visit an Orphanage</h3> <p>Go beyond and experience their stories first hand.<br><br></p> <a class="uc" href="/get-involved/visit-an-orphanage">Learn More</a> </div>
That code above comes from the home page of soworldwide(dot)org. On the site, you will see that the 3 different divs are entitled, “Adopt an Orphanage,” “Run Your Own Campaign,” and “Visit an Orphanage.” In this example, their custom post type would be Get Involved. Mine is called Books, but it’s the same concept.
What’s the best way to set this up? I’m just starting to dive into custom themes, so I’m still learning basic concepts.
Thank you Jan! That worked great! ??
Forum: Themes and Templates
In reply to: Search results page pagination leading to 404 errorI am so afraid to switch themes, then switch back. I have edited so many theme files. Will everything return to normal if I do this?
Forum: Themes and Templates
In reply to: Search results page pagination leading to 404 errorI did something which I think is similar to what you suggested. I replaced the Woo Search widget with another one called Advanced Search Widget. When I did the search, I had the exact same problem…pages 2 and up return a 404. Page 1 worked, but looked like this: https://domain.com/?s=the+dog&posttype=post&widget=advanced-search-widget-2.
Could the issue be related to the pagination code?
Forum: Themes and Templates
In reply to: Search results page pagination leading to 404 errorOk, well that sucks. Unfortunately I don’t have a login to their support system.
Any idea what template I should look in to edit the code?
Forum: Themes and Templates
In reply to: Search results page pagination leading to 404 errorNo, I’m not using a plugin. I am using a WooThemes theme though, so I’m not sure if that affects anything.
The URL of the first page looks like this: https://domain.com/?s=the+dog&submit.x=0&submit.y=0&submit=Go
But when I click page 2, it looks like this: https://domain.com/search/thedog/page/2/
Forum: Themes and Templates
In reply to: Pagination showing same posts on all pagesI realized I was editing the wrong file. I had to remove
<?php woo_pagenav(); ?>
from my archives.php template.