Wordpress Help
- Started
- Last post
- 6 Responses
- trooperbill
Hi peeps. Ive created a website to showcase my growing collection of intage timex watches on the domain timetrope.com
i'm no wordpress deeloper but id like to add a text area below the listing of blog posts
When ie searched google it talks about widgets but these all seem to be predefined and are not part of the theme im using.
i wouldnt want the text to be repeated across all paginated pages.
does that make sense and any idea how i do it?
thanks
mark
- imbecile3
the V is broken on your keyboard
- imbecile1
It's a matter of adding some code of some sort to the index theme page format.
you can add it static or dynamically.
in the index.php document, you'll find...
<?php endif; ?>
</div><!-- .section-inner -->
WHAT YOU WANT TO ADD GOES RIGHT HERE
<?php
get_template_part( 'pagination' );
get_footer(); ?>
- this appears across all paginated pagestrooperbill
- That is correctimbecile
- imbecile1
make a copy of the main index page you'll be editing. save it as the original in case you mess things up. create a page with the copy you want to display above the navigation so that it's dynamic. note the page id or slug. open your theme's template file for the homepage. find the above location in the template file where you want to display the text from the other page.
page id:
$page_id = QBN; // Replace QBN with the actual page ID
$page = get_post($page_id);
if ($page) {
$content = apply_filters('the_content', $page->post_content);
echo $content;
}or page slug
$page_slug = 'yo-its-qbn'; // Replace 'yo-its-qbn' with your page slug
$page = get_page_by_path($page_slug);
if ($page) {
$content = apply_filters('the_content', $page->post_content);
echo $content;
}
- imbecile1
I'm not exactly sure what you mean by "i wouldnt want the text to be repeated across all paginated pages."
do you want this information only displayed on the homepage? but not if I go to page 2 from the homepage thumbnail navigation??
If so...
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
if ($paged === 1) {
$page_id = Newstoday; // Replace Newstoday with your page id
$page = get_post($page_id);
if ($page) {
$content = apply_filters('the_content', $page->post_content);
echo $content;
}
}- Yes on the home page but not on other page that share the templatetrooperbill
- should work thenimbecile
- dbloc1
just add the text on index.php below the loop between an if statement to only show it on the home page.
<?php if(is_front_page)) : ?> TEXT HERE <?php endif; ?>
- If it's a page template for the Home Page add it there instead.dbloc
- don't add anything to the index.phpsted
- yeah i only have index.php it replicates across all paginated pages :(trooperbill
- Gnash0
Nice collection, btw
- thanks its 4 years in the making im about 50% of the way through getting the basics onlinetrooperbill