I am trying to establish 2 x custom page templates for a site using Zerif Pro on Wordpress 4.7.3
I have created the template files but can't get the layout I want.
I am trying to get a full-width template where the content appears directly below the navbar.
Using inspect element I can edit the CSS to
.content-left-wrap {
padding-top: 0px;
}
And get the desired look, but I can't figure out what to change in my fullwidth.php file or where to put it.
Template Code Below:
<div class="clear"></div>
</header> <!-- / END HOME SECTION -->
<?php zerif_after_header_trigger(); ?>
<div id="content" class="site-content">
<div class="container">
<div class="content-left-wrap col-md-12">
<div id="primary" class="content-area">
<main id="main" class="site-main" role="main">
<?php
while ( have_posts() ) :
the_post();
get_template_part( 'content', 'page-no-title' );
/* If comments are open or we have at least one comment,
load up the comment template */
if ( comments_open() || '0' != get_comments_number() ) :
comments_template();
endif;
endwhile;
?>
</main><!-- #main -->
</div><!-- #primary -->
</div><!-- .content-left-wrap -->
</div><!-- .container -->
<?php
get_footer();
?>
Edit fullwidth.php Add another class to this div like this
<div class="content-left-wrap wrap-new col-md-12">
and then add css to the template css file using the new class
.wrap-new
{
.content-left-wrap {
padding-top: 0px;
}
}
Related
I'm working on a custom WP theme with a blog page. The Blog page is showing the posts but when you click on each post, it takes you to an empty page.
I've set: Settings > Post Page > Blog
Basically, blog page displays all content but BLOG POST page is blank. Here's my index.php.
<div class="header-img-container container-fluid">
<img
class="header-img"
role="banner"
src="http://cc.local/wp-content/uploads/2020/04/blog-page.jpg"
>
<hr class="horizontal-line">
</div>
<div class="container">
<div class="row">
<div class="col">
<div class="vertical-center">
<form action="http://cc.fullslate.com/">
<button class="appointment-button btn button">Schedule</button>
</form>
</div>
<p class="page-body-title">Blog</p>
<div id="primary" class="content-area">
<main id="main" class="site-main">
<?php
if ( have_posts() ) {
// Load posts loop.
while ( have_posts() ) {
the_post();
get_template_part( 'template-parts/content/content' );
}
// Previous/next page navigation.
//cc_the_posts_navigation();
} else {
// If no content, include the "No posts found" template.
get_template_part( 'template-parts/content/content', 'none' );
}
?>
</main><!-- .site-main -->
</div><!-- .content-area -->
</div>
</div>
</div>
If you want to edit the view of a single post, you need to use the single.php
Find out more about template hierarchy in wordpress:
https://developer.wordpress.org/themes/basics/template-hierarchy/
Here is what it should look like:
https://developer.wordpress.org/themes/template-files-section/post-template-files/
You can adjust this single.php to your needs, it will work as it is because of the post loop in it.
My Wordpress blog works fine on the main page that shows all posts, however, when I click a category the most recent post's title becomes the main header and that post doesn't even show up in the blog post list of that category.
https://ibb.co/ebReRV
I spied on other people with the same theme as me and they have the same problem so I believe this is a problem with the original code. My theme's creator seems to have disappeared and hasn't responded to any of my messages.
archive.php
<section id="wp-main-content" class="clearfix main-page title-layout-standard">
<?php do_action( 'naturalfood_before_page_content' ); ?>
<div class="container">
<div class="main-page-content row">
<!-- Main content -->
<div class="content-page <?php echo esc_attr($main_content_config['class']); ?>">
<div id="wp-content" class="wp-content">
<?php get_template_part('templates/layout/archive') ?>
</div>
</div>
You Need to Create Archive Page
Give Archive Page name is "archive.php".
Archive Page Structure Like this:
<?php
/*
Template Name: Archives
*/
get_header(); ?>
<div id="primary" class="site-content">
<div id="content" role="main">
<?php while ( have_posts() ) : the_post(); ?>
<h1 class="entry-title"><?php the_title(); ?></h1>
<div class="entry-content">
<?php the_content(); ?>
/* Custom Archives Functions Go Below this line */
/* Custom Archives Functions Go Above this line */
</div><!-- .entry-content -->
<?php endwhile; // end of the loop. ?>
</div><!-- #content -->
</div><!-- #primary -->
<?php get_sidebar(); ?>
<?php get_footer(); ?>
For some reason my footer disappeared for my site http://juliannaspizza.com.
I checked the template file for the home page and get_footer is being called as shown below. Any idea why my footer is still not showing up?
<?php
/**
* Template Name: Full Width Page
*
* #package Fortune
*/
get_header();
get_template_part( 'parts/single', 'page-header' ); ?>
<div class="container full-width-page">
<div class="row">
<div id="primary" class="content-area col-lg-12">
<main id="main" class="site-main" role="main">
<?php
while ( have_posts() ) : the_post();
get_template_part( 'content', 'page' );
if ( comments_open() || get_comments_number() ) {
comments_template();
}
endwhile; ?>
</main><!-- #main -->
</div><!-- #primary -->
</div><!-- .row -->
</div><!-- .container -->
<?php
get_footer();
This is what my footer used to look like (https://certifagift.blog/):
Your widgets are gone. From the markup, it looks like your footer (which does appear) is expecting to have widgets, but those are not appearing. Go to Appearance -> Widgets in your dashboard and add your widgets back in, and you should be good.
I have a template in my Genesis theme child that is assigned to my homepage with a div that has an ID that I've styled in a separate CSS file.
That div contains a text, in the CSS sheet there's a background image to it.
I have a styled header through hooking it up through functions.
I have a footer aswell.
The problem is - the div that I mentioned is rendered below all these elements, as if it's not a part of the genesis structure.
There's header, footer, and below that the image with the text.
If I edit the page through the dashboard a new post is created that is positioned correctly.
How do I display the picture between the header and footer like it should be?
The code for the homepage template is:
<?php
/*
Template Name: Homepage Template
*/
genesis();
echo "<link rel='style' type='text/css' href='styles.css' />";
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">
</header><!-- .entry-header -->
<div class="entry-content">
<div id="home_slider">
Electrical & Mechanical Engineering<br>In Nigera
</div>
</div><!-- .entry-content -->
</article><!-- #post-## -->
<?php endwhile; // End the loop. ?>
</main><!-- .site-main -->
</div><!-- .content-area -->
<?php get_footer(); ?>
The thing about Genesis content is that you have to use the Genesis hooks to add content to your page. There is a great visual guide for this here: http://genesistutorials.com/visual-hook-guide/
In your case, if you wanted to place your div just before the content area, you could do the following:
/**
* Template Name: Homepage Template
*/
add_action('genesis_before_content', 'add_extra_content_div');
function add_extra_content_div(){
?>
<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">
</header><!-- .entry-header -->
<div class="entry-content">
<div id="home_slider">
Electrical & Mechanical Engineering<br>In Nigera
</div>
</div><!-- .entry-content -->
</article><!-- #post-## -->
<?php endwhile; // End the loop. ?>
</main><!-- .site-main -->
</div><!-- .content-area -->
?>
}
genesis();
One other point is that in Genesis you do not need to put in get_header() and get_footer() so you should remove these from your template.
Also, make sure that genesis(); is the very last line in the template - this is very important.
A bit of an odd one. My news posts are not displaying through their unique URL.
Example:
- through the site you can see the news section and click through:
http://disciplesldn.com/
As a stand alone post, content disappears:
http://disciplesldn.com/2014/12/win-tickets-to-see-us-play-in-liverpool-on-boxing-day/
The theme is a custom build, using wordpress plugin 'types' for posting as single.php template file.
single.php code example:
<?php get_header(); the_post(); ?>
<section id="singlepost">
<div class="loadwrapper">
<div class="titleheaderpost">
<h1 class="singletitle"><? the_title(); ?></h1>
<p class="back">< back to News</p>
</div><!-- end of .titleheader -->
<div class="thenewscontent" id="thecontent">
<? the_content(); ?>
</div>
</div>
</section><!-- end of #singlepost -->
<?php get_footer(); ?>
In your css on line 757 you have positioning styled on the 'singlepost' id. you need to remove the left & top rules and the post displays correctly.
eg:
#singlepost {
position: relative;
/* left: 1200px; */
/* top: -482px; */
max-width: 960px;
overflow: hidden;
height: 100%;
margin: 0 auto;
}
Try with this code.
<?php get_header();?>
<?php while ( have_posts() ) : the_post(); ?>
<section id="singlepost">
<div class="loadwrapper">
<div class="titleheaderpost">
<h1 class="singletitle"><? the_title(); ?></h1>
<p class="back">< back to News </p>
</div><!-- end of .titleheader -->
<div class="thenewscontent" id="thecontent">
<? the_content(); ?>
</div>
</div>
</section><!-- end of #singlepost -->
<?php endwhile; // end of the loop. ?>
<?php get_footer(); ?>