My footer.php file will pull into every page except the single.php, I have no idea why this is occurring! Any ideas?
Below is the Single.php code
<?php get_header(); ?>
<div class="page-content">
<div class="small-banner">
<h1><?php the_title(); ?></h1>
<img src="http://www.quorngrangehotel.local/wp-content/uploads/2017/04/new-events-banner.jpg">
</div>
<main role="main" class="mainContent">
<div id="inner-content" class="row">
<main id="main" class="large-8 medium-8 columns" role="main">
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php get_template_part( 'parts/loop', 'single' ); ?>
<?php endwhile; else : ?>
<?php get_template_part( 'parts/content', 'missing' ); ?>
<?php endif; ?>
</main> <!-- end #main -->
</div> <!-- end #inner-content -->
</main><!-- end #content -->
<?php get_footer(); ?>
I found out the issue it was something to do with the comments section being pulled in via the single template part!
Related
I have the following archive page setup:
<?php
get_header(); ?>
<div id="container">
<div id="content" role="main">
<?php the_post(); ?>
<h1 class="entry-title"><?php the_title(); ?></h1>
<?php get_search_form(); ?>
<h2>Archives by Month:</h2>
<ul>
<?php wp_get_archives('type=monthly'); ?>
</ul>
<h2>Archives by Subject:</h2>
<ul>
<?php wp_list_categories(); ?>
</ul>
</div><!-- #content -->
</div><!-- #container -->
<?php get_sidebar(); ?>
<?php get_footer(); ?>
However, the page is completely white when I load the archive page. It is a new site with no plugins, and all the other pages are working fine. Any idea?
For some weird reason, the archive became visible when i added the code to the index.php file.
<?php get_header(); ?>
</div><!--END CONTAINER-->
<?php
if (get_field('header_image')){
$image = get_field('header_image');
if (get_field('do_not_use_page_title')){
$title = get_field('alternate_page_title');
}else {
$title = get_the_title();
}
if (get_field('subheading')) $subheading = get_field('subheading');
?>
<div class="page-header" style="background-image: url(<?php echo $image['url']?>);">
<?php echo "<h1>$title</h1>"; ?>
<?php if ($subheading) { echo "<h2>$subheading</h2>";} ?>
</div>
<?
}
?>
<div class="container">
<div id="content" class="clearfix row">
<div id="main" class="col-sm-8 clearfix" role="main">
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<article id="post-<?php the_ID(); ?>" <?php post_class('clearfix'); ?> role="article" itemscope itemtype="http://schema.org/BlogPosting">
<?php if (!(get_field('header_image'))) { ?>
<header>
<div class="page-header"><h1 class="page-title" itemprop="headline"><?php the_title(); ?></h1></div>
</header> <!-- end article header -->
<?php } ?>
<section class="post_content clearfix" itemprop="articleBody">
<?php the_content(); ?>
</section> <!-- end article section -->
</article> <!-- end article -->
<?php endwhile; ?>
<?php else : ?>
<article id="post-not-found">
<header>
<h1><?php _e("Not Found", "wpbootstrap"); ?></h1>
</header>
<section class="post_content">
<p><?php _e("Sorry, but the requested resource was not found on this site.", "wpbootstrap"); ?></p>
</section>
<footer>
</footer>
</article>
<?php endif; ?>
</div> <!-- end #main -->
</div> <!-- end #content -->
When creating a new page in WP I get an error
Parse error: syntax error, unexpected end of file in /home/example.com/example/public_html/wp-content/themes/exampletheme/page.php on line 69
I haven't been able to find any errors in the php that would trigger this parse error. Other pages that were already present on the website work fine, but making new pages and then viewing/previewing them brings an empty page with the above error. Any help would be appreciated, Thanks.
I'm new to PHP and I made my first custom page template using the Genesis framework.
I've created a theme child to the main parent Genesis, it is active and recognizable as the child, there are no errors on the dashboard of the themes.
The problem is straight forward, when I place the template in the parent directory, no problem, it is displayed in the drop down menu of the page template selection when creating a new page, however, when I place it in the child theme's dir, it does now show.
I tried to copy index.php to the child dir but no go, it only shows when it's in the parent's.
I've looked everywhere, and having a problem which I think is sourced through the method of wordpress looking for theme templates only on the parent's dir and excluding the child.
Any suggestions would be gladly appreciated.
there's the code for the template:
<?php
/*
Template Name: About Template
*/
?>
<?php get_header(); ?>
<div id="primary" class="content-area">
<main id="main" class="site-main" role="main">
<?php
// Start the loop.
while ( have_posts() ) : the_post(); ?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<header class="entry-header">
<?php the_title( '<h1 class="entry-title">', '</h1>' ); ?>
</header><!-- .entry-header -->
<div class="entry-content">
<?php if ( have_rows('about') ):
while ( have_rows('about') ): the_row(); ?>
<h2><?php the_sub_field('content_area'); ?></h2>
</div><!-- .entry-content -->
</article><!-- #post-## -->
<?php endwhile; // End the loop. ?>
</main><!-- .site-main -->
</div><!-- .content-area -->
<?php get_footer(); ?>
Use this code it will works
<?php
/*
Template Name:New template name
*/
get_header();?>
<div id="primary" class="content-area">
<main id="main" class="site-main" role="main">
<?php
// Start the loop.
while ( have_posts() ) : the_post(); ?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<header class="entry-header">
<?php the_title( '<h1 class="entry-title">', '</h1>' ); ?>
</header><!-- .entry-header -->
<div class="entry-content">
<?php if ( have_rows('about') ):
while ( have_rows('about') ): the_row(); ?>
<h2><?php the_sub_field('content_area'); ?></h2>
</div><!-- .entry-content -->
</article><!-- #post-## -->
<?php endwhile; // End the loop. ?>
</main><!-- .site-main -->
</div><!-- .content-area -->
<?php get_footer();?>
Use this it is working in my child genesis theme
<?php
/*
Template Name: Template Nmae
*/
?>
<div id="primary" class="content-area">
<main id="main" class="site-main" role="main">
<?php
// Start the loop.
while ( have_posts() ) : the_post(); ?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<header class="entry-header">
<?php the_title( '<h1 class="entry-title">', '</h1>' ); ?>
</header><!-- .entry-header -->
<div class="entry-content">
<?php if ( have_rows('about') ):
while ( have_rows('about') ): the_row(); ?>
<h2><?php the_sub_field('content_area'); ?></h2>
</div><!-- .entry-content -->
</article><!-- #post-## -->
<?php endwhile; // End the loop. ?>
</main><!-- .site-main -->
</div><!-- .content-area -->
<?php get_footer(); ?>
I created custom theme with WordPress and bootstrap and everything works fine except previous and next link in singe.php.
Here is my code:
<?php get_header(); ?>
<article>
<div class="container single-project">
<?php if (have_posts()) : while (have_posts()) : the_post();?>
<div class="row">
<div class=" col-md-4 col-lg-4 pull-right">
<header class="entry-header">
<h1 id="post-<?php the_ID(); ?>"><?php the_title();?></h1>
<hr>
</header><!-- .entry-header -->
</div>
<div class=" hidden-md hidden-lg"><hr></div>
<div class="col-md-4 col-lg-4"><?php the_content(); ?></div>
<?php previous_posts_link() ?>
<?php next_posts_link() ?>
</div> <!-- end of row -->
</div> <!-- end of container -->
<?php endwhile; endif; ?>
</article>
<?php get_footer(); ?>
Thanks in advance.
You have to move
<?php previous_posts_link() ?>
<?php next_posts_link() ?>
after
</article>
preferably inside some div so you can style it, like
<div class="navi">
<?php previous_posts_link() ?>
<?php next_posts_link() ?>
</div>
Found solution:
<?php previous_post('« « %', 'Previous Post', 'yes'); ?> |
<?php next_post('% » » ', 'Next Post', 'yes'); ?>
http://wpsites.net/web-design/previous-next-single-post-navigation-links-wordpress/
I am trying to use Reveal.js (https://github.com/hakimel/reveal.js/) on WordPress with the Posts being the content per each slide.
I have gotten the post to display properly on the slides, but I am having trouble finding a way to wrap posts that have the same category in a tag.
Basically, My current code looks something like this:
<section class="section chapter-1 ">
</section>
<section class="section chapter-1 ">
</section>
<section class="section chapter-1 ">
</section>
<section class="section chapter-2 ">
</section>
<section class="section chapter-2 ">
</section>
But I need it to look like this:
<section id="category-1">
<section class="section chapter-1 ">
</section>
<section class="section chapter-1 ">
</section>
<section class="section chapter-1 ">
</section>
</section>
<section id="category-2">
<section class="section chapter-2 ">
</section>
<section class="section chapter-2 ">
</section>
</section>
Here is my index.php code:
<div class="reveal content-area">
<div id="content" class="slides site-content" role="main">
<?php if ( have_posts() ) : ?>
<?php /* The loop */ ?>
<?php while ( have_posts() ) : the_post(); ?>
<?php get_template_part( 'content', get_post_format() ); ?>
<?php endwhile; ?>
<?php twentythirteen_paging_nav(); ?>
<?php else : ?>
<?php get_template_part( 'content', 'none' ); ?>
<?php endif; ?>
</div><!-- #content -->
</div><!-- #primary -->
... and so on with more 'chapters' and more categories
If you notice the second code example are grouped and wrapped in a section tag with an ID of the category name.
you could do this, or have an array with categories
<?php
$args = array( 'category' => 1 );
get_posts($args);
?>
<section id="category-1">
<?php
if (have_posts()) : while (have_posts()) : the_post();
?>
<section class="section chapter-<?php the_ID()?> ">
the_content();
</section>
<?php
endwhile; endif;
?>
</section>
<?php
wp_reset_query();
$args = array( 'category' => 2 );
get_posts($args);
<section id="category-2">
if (have_posts()) : while (have_posts()) : the_post();
<section class="section chapter-<?php the_ID()?> ">
the_content();
</section>
endwhile; endif;
</section>
wp_reset_query();
?>