Footer in my sidebar - wordpress

I have read the other answers on SOF, and cannot find out where my error is at. On my homepage and other pages selected to no have a sidebar have the footer credits moving up into the side of my site! :(
Added 4/11/17:
Here is the footer.php:
<div class="site-info">
Proudly created by Ryan Anderson
<br>
Privacy Policy
</div><!-- .site-info -->
Here is the index.php that I created recently that might have issues??
get_header(); ?>
<div id="primary" class="content-area">
<main id="main" class="site-main" role="main">
<?php if ( have_posts() ) : ?>
<?php /* Start the Loop */ ?>
<?php while ( have_posts() ) : the_post(); ?>
<?php
/*
* Include the Post-Format-specific template for the content.
* If you want to override this in a child theme, then include a file
* called content-___.php (where ___ is the Post Format name) and that will be used instead.
*/
get_template_part( 'template-parts/content', get_post_format() );
?>
<?php endwhile; ?>
<?php the_posts_navigation(); ?>
<?php else : ?>
<?php get_template_part( 'template-parts/content', 'none' ); ?>
<?php endif; ?>
</main><!-- #main -->
</div><!-- #primary -->
<?php if (!is_front_page()) {
get_sidebar();
} ?>
<?php get_footer(); ?>

Found what I needed. Stylesheet needed this added to stop the float:
.site-info {
clear: both
}

Related

WordPress single post template layout

I'm not too famiiar with WordPress but, I've created the following page to display custom post types single-opportunities.php:
<?php
/**
* The Template for displaying single opportunities posts.
**/
get_header();
global $accesspresslite_options, $post;
$accesspresslite_settings = get_option( 'accesspresslite_options', $accesspresslite_options );
$post_class = get_post_meta( $post -> ID, 'accesspresslite_sidebar_layout', true );
?>
<div class="ak-container">
<?php
if ($post_class=='both-sidebar') { ?>
<div id="primary-wrap" class="clearfix">
<?php }
?>
<div id="primary" class="content-area">
<main id="main" class="site-main" role="main">
<?php while ( have_posts() ) : the_post(); ?>
<?php get_template_part( 'content', 'single' ); ?>
<?php // accesspresslite_post_nav(); ?>
<?php
// 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;
?>
<?php endwhile; // end of the loop.
?>
</main><!-- #main -->
</div><!-- #primary -->
<?php
get_sidebar('left');
if ($post_class=='both-sidebar') { ?>
</div>
<?php }
?>
</div>
<?php get_footer(); ?>
I've added a custom post type and this page is displaying the information OK, but the layout has a sidebar on the right. I'm not sure why it is displaying the sidebar on the right? Can this default option be changed.
Ideally I'd like to edit the template above so the layout has a left sidebar, that I can then add a custom menu into.
Looks like youre calling the sidebar after the main body of the post/page. Call it before to have it show up on the left side.
/**
* The Template for displaying single opporunities posts.
*
*/
get_header();
global $accesspresslite_options, $post;
$accesspresslite_settings = get_option( 'accesspresslite_options',
$accesspresslite_options );
$post_class = get_post_meta( $post -> ID, 'accesspresslite_sidebar_layout', true );
?>
<div class="ak-container">
<?php
if ($post_class=='both-sidebar') { ?>
<div id="primary-wrap" class="clearfix">
<?php }
get_sidebar('left');
?>
<div id="primary" class="content-area">
<main id="main" class="site-main" role="main">
<?php while ( have_posts() ) : the_post(); ?>
<?php get_template_part( 'content', 'single' ); ?>
<?php // accesspresslite_post_nav(); ?>
<?php
// 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;
?>
<?php endwhile; // end of the loop.
?>
</main><!-- #main -->
</div><!-- #primary -->
<?php
if ($post_class=='both-sidebar') { ?>
</div>
<?php }
?>

Display Wordpress home posts in 3 columns?

I am using Bootstrap based starter theme "Understrap", which incorporates bootsrap into Underscores.
My goal would be to display my latest posts on the front page in three columns horizontally, so:
1 2 3
4 5 6
7 8 9
...
I'm a beginner, so i'm having a hard time figuring out how to approach this with Understrap.
My Index.php code is shown below. Any help would be greatly appreciated!
<?php
/**
* The main template file.
*
* This is the most generic template file in a WordPress theme
* and one of the two required files for a theme (the other being style.css).
* It is used to display a page when nothing more specific matches a query.
* E.g., it puts together the home page when no home.php file exists.
* Learn more: http://codex.wordpress.org/Template_Hierarchy
*
* #package understrap
*/
get_header();
$container = get_theme_mod( 'understrap_container_type' );
$sidebar_pos = get_theme_mod( 'understrap_sidebar_position' );
?>
<?php if ( is_front_page() && is_home() ) : ?>
<?php get_template_part( 'global-templates/hero', 'none' ); ?>
<?php endif; ?>
<div class="wrapper" id="wrapper-index">
<div class="<?php echo esc_html( $container ); ?>" id="content" tabindex="-1">
<div class="row">
<!-- Do the left sidebar check and opens the primary div -->
<?php get_template_part( 'global-templates/left-sidebar-check', 'none' ); ?>
<main class="site-main" id="main">
<?php if ( have_posts() ) : ?>
<?php /* Start the Loop */ ?>
<?php while ( have_posts() ) : the_post(); ?>
<?php
/*
* Include the Post-Format-specific template for the content.
* If you want to override this in a child theme, then include a file
* called content-___.php (where ___ is the Post Format name) and that will be used instead.
*/
get_template_part( 'loop-templates/content', get_post_format() );
?>
<?php endwhile; ?>
<?php else : ?>
<?php get_template_part( 'loop-templates/content', 'none' ); ?>
<?php endif; ?>
</main><!-- #main -->
<!-- The pagination component -->
<?php understrap_pagination(); ?>
</div><!-- #primary -->
<!-- Do the right sidebar check -->
<?php if ( 'right' === $sidebar_pos || 'both' === $sidebar_pos ) : ?>
<?php get_sidebar( 'right' ); ?>
<?php endif; ?>
</div><!-- .row -->
</div><!-- Container end -->
</div><!-- Wrapper end -->
<?php get_footer(); ?>
You can use the row / columns class from Bootstrap, and a counter ($i) to restart a row after 3 columns. Here is a idea of changes based on your code :
<?php
/**
* The main template file.
*
* This is the most generic template file in a WordPress theme
* and one of the two required files for a theme (the other being style.css).
* It is used to display a page when nothing more specific matches a query.
* E.g., it puts together the home page when no home.php file exists.
* Learn more: http://codex.wordpress.org/Template_Hierarchy
*
* #package understrap
*/
get_header();
$container = get_theme_mod( 'understrap_container_type' );
$sidebar_pos = get_theme_mod( 'understrap_sidebar_position' );
?>
<?php if ( is_front_page() && is_home() ) : ?>
<?php get_template_part( 'global-templates/hero', 'none' ); ?>
<?php endif; ?>
<div class="wrapper" id="wrapper-index">
<div class="<?php echo esc_html( $container ); ?>" id="content" tabindex="-1">
<div class="row">
<!-- Do the left sidebar check and opens the primary div -->
<?php get_template_part( 'global-templates/left-sidebar-check', 'none' ); ?>
<main class="site-main" id="main">
<?php if ( have_posts() ) : ?>
<?php $i = 1; ?>
<div class="row">
<?php /* Start the Loop */ ?>
<?php while ( have_posts() ) : the_post(); ?>
<div class="col-sm-4">
<?php
/*
* Include the Post-Format-specific template for the content.
* If you want to override this in a child theme, then include a file
* called content-___.php (where ___ is the Post Format name) and that will be used instead.
*/
get_template_part( 'loop-templates/content', get_post_format() );
?>
</div><!-- /.col -->
<?php
if( $i == 3 ){
echo '</div><div class="row">';
$i = 0;
}
$i++;
?>
<?php endwhile; ?>
</div><!-- /.row -->
<?php else : ?>
<?php get_template_part( 'loop-templates/content', 'none' ); ?>
<?php endif; ?>
</main><!-- #main -->
<!-- The pagination component -->
<?php understrap_pagination(); ?>
</div><!-- #primary -->
<!-- Do the right sidebar check -->
<?php if ( 'right' === $sidebar_pos || 'both' === $sidebar_pos ) : ?>
<?php get_sidebar( 'right' ); ?>
<?php endif; ?>
</div><!-- .row -->
</div><!-- Container end -->
</div><!-- Wrapper end -->
<?php get_footer(); ?>
Hope I will help !

Different css on posts in wordpress

First I'm going to explain the problem. I have a wordpress website with a few pages. One of the pages is the page that shows the summary of all the articles.
This is all working fine. What I want to archieve is the following:
Article 1 should be aligned to the left of the page, Article 2 should be aligned to the right and so on. (LEFT - RIGHT - LEFT - RIGHT - LEFT - ... )
I have no idea how to start. I have done some research and maybe wp_count_posts() is going to help me but I can't fix it.
Single.php (template for 1 post)
get_header(); ?>
<section class="news-area">
<div class="wrapper" role="main">
<?php while ( have_posts() ) : the_post(); ?>
<?php
$count = count_posts( $type, $perm );
echo $count;
?>
<?php get_template_part( 'content', 'single' ); ?>
<?php group_joosen_post_nav(); ?>
<?php
// 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;
?>
<?php endwhile; // end of the loop. ?>
</div><!--END wrapper-->
</section>
<?php get_sidebar(); ?>
<?php get_footer(); ?>
content.php ("template" for all the posts)
<article class="teasers" id="post-<?php the_ID(); ?>">
<div class="datum">
<div class="day">
<?php the_time('d') ?>
</div>
<div class="month">
/<?php the_time('m') ?>
</div>
<div class="year">
<?php the_time('Y') ?>
</div>
</div>
<div class="teaserscontent">
<h1><?php the_title(); ?></h1>
<?php if ( is_search() ) : // Only display Excerpts for Search ?>
<?php the_excerpt(); ?>
<?php else : ?>
<?php the_content( __( 'Lees meer', 'transport_joosen' ) ); ?>
<?php endif; ?>
</div>
</article><!-- #post-<?php the_ID(); ?> -->
You may be able to do this simply with CSS. Assuming the HTML has all article elements as siblings:
http://jsfiddle.net/isherwood/53rh3/
article {
width: 47%;
padding: 1%;
margin: 1%;
box-sizing: border-box;
display: inline-block;
vertical-align: top;
}

Read more tag not working on page - WordPress

Not sure what is wrong here as have found the same fix all over the place for my issue. Read more tags are not showing on my page that pulls in the latest posts. I have researched that simply adding this code will fix that.
<?php
global $more;
$more = 0;
?>
//The code must be inserted ahead of the call to the content
<?php the_content('Continue Reading'); ?>
However I can't seem to get it to work. Any other ideas or am I just using the code wrong, quote possible! Here is an idea of my page, any help in identifying where to insert the code would be much appreciated. Thanks very much guys!
get_header(); ?>
<div id="primary" class="site-content">
<div id="content" role="main">
<?php while ( have_posts() ) : the_post(); ?>
<?php if ( has_post_thumbnail() ) : ?>
<div class="entry-page-image">
<?php the_post_thumbnail(); ?>
</div><!-- .entry-page-image -->
<?php endif; ?>
<?php get_template_part( 'content', 'page' ); ?>
<?php endwhile; // end of the loop. ?>
</div><!-- #content -->
</div><!-- #primary -->
<?php get_sidebar( 'front' ); ?>
<?php get_footer(); ?>
try this.code.check wether you have given insert more tag in admin for pages and post
get_header(); ?>
<div id="primary" class="site-content">
<div id="content" role="main">
<?php while ( have_posts() ) : the_post(); ?>
<?php if ( has_post_thumbnail() ) : ?>
<div class="entry-page-image">
<?php the_post_thumbnail(); ?>
</div><!-- .entry-page-image -->
<?php endif; ?>
<?php
global $more;
$more = 0;
get_template_part( 'content', 'page' ); ?>
<?php endwhile; // end of the loop. ?>
</div><!-- #content -->
</div><!-- #primary -->
<?php get_sidebar( 'front' ); ?>
<?php get_footer(); ?>

Custom Blog Post Listing in Genesis Sample Child Theme

I want to add several images and divs and also customize the look of my Blog post listing... But i can't find the way to do it.
Here's the Blog Template code
<?php
/*
WARNING: This file is part of the core Genesis framework. DO NOT edit
this file under any circumstances. Please do all modifications
in the form of a child theme.
*/
/**
* Template Name: Blog
* This file handles blog post listings within a page.
*
* This file is a core Genesis file and should not be edited.
*
* The blog page loop logic is located in lib/structure/loops.php
*
* #category Genesis
* #package Templates
* #author StudioPress
* #license http://www.opensource.org/licenses/gpl-license.php GPL v2.0 (or later)
* #link http://www.studiopress.com/themes/genesis
*/
genesis();
and just above the genesis(); code.. i tried to put some divs and images there.. But i guess that's not the way it works. ..
I also tried to make my own Blog listing template using a normal wordpress code theme..
<?php /*
Template Name: List Post Pages
*/
?>
<?php get_header(); ?>
<?php if ( has_post_thumbnail() ) { ?>
<div class="featured">
<?php the_post_thumbnail(); ?>
</div>
<?php } ?>
<div class="divider"></div>
<div id="content" class="hfeed">
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<div <?php post_class() ?> id="post-<?php the_ID(); ?>">
<h2><a href="<?php the_permalink() ?>">
<?php the_title(); ?>
</a></h2>
<div class="entry">
<?php the_content(); ?>
</div>
<div class="postmetadata">
<?php the_tags('Tags: ', ', ', '<br />'); ?>
Posted in
<?php the_category(', ') ?>
|
<?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?>
</div>
</div>
<?php endwhile; ?>
<?php else : ?>
<h2>Not Found</h2>
<?php endif; ?>
<?php genesis_after_loop(); ?>
</div>
<?php get_footer(); ?>
But no luck, what's the right way to do this?
***Update -code below is the one i want.. but instead of having the Content of the page. I want the list of Post with excerpts ....How can i do that????
<?php /*
Template Name: Page Template
*/ ?>
<?php get_header(); ?>
<?php if ( has_post_thumbnail() ) { ?>
<div class="featured">
<?php the_post_thumbnail(); ?>
</div>
<?php } ?>
<div class="divider"></div>
<?php genesis_before_content_sidebar_wrap(); ?>
<div id="content-sidebar-wrap">
<?php genesis_before_content(); ?>
<div id="content" class="hfeed">
<?php genesis_before_loop(); ?>
<?php genesis_loop(); ?>
<?php genesis_after_loop(); ?>
</div>
<!-- end #content -->
<?php genesis_after_content(); ?>
</div>
<!-- end #content-sidebar-wrap -->
<?php genesis_after_content_sidebar_wrap(); ?>
<?php get_footer(); ?>
Im shocked that no one answered my question.. anyway, if someone bumps onto this post with similar problem. The answer is adding
<?php query_posts( $args ); ?>
just above the <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
All in all, my code looks like this ...
<?php /*
Template Name: Page Template
*/ ?>
<?php get_header(); ?>
<?php if ( has_post_thumbnail() ) { ?>
<div class="featured">
<?php the_post_thumbnail(); ?>
</div>
<?php } ?>
<div class="divider"></div>
<?php genesis_before_content_sidebar_wrap(); ?>
<div id="content-sidebar-wrap">
<?php genesis_before_content(); ?>
<div id="content" class="hfeed">
<?php genesis_before_loop(); ?>
<?php query_posts( $args ); ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<div <?php post_class() ?> id="post-<?php the_ID(); ?>">
<h2><a href="<?php the_permalink() ?>">
<?php the_title(); ?>
</a></h2>
<div class="entry">
<?php the_content(); ?>
</div>
<div class="postmetadata">
<?php the_tags('Tags: ', ', ', '<br />'); ?>
Posted in
<?php the_category(', ') ?>
|
<?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?>
</div>
</div>
<?php endwhile; ?>
<?php else : ?>
<h2>Not Found</h2>
<?php endif; ?>
<?php genesis_after_loop(); ?>
</div>
<!-- end #content -->
<?php genesis_after_content(); ?>
</div>
<!-- end #content-sidebar-wrap -->
<?php genesis_after_content_sidebar_wrap(); ?>
<?php get_footer(); ?>

Resources