wordpress theme twentysixteen page content not Display - php

I am using Wordpress twenty sixteen theme in my project, but page content, not displaying on front site in WP-admin adds page and puts content and update my front site display code is now:
<?php while ( have_posts() ) : the_post(); get_template_part( 'content', 'page' ); ?><?php //comments_template( '', true ); ?><?php endwhile; ?>

Content not showing up can be due to a few issues, but without access to your site, it's nearly impossible to be sure.
Here are a few things to try:
Disable all plugins to make sure none of them are interfering with your site. If your site reappear, Deena Le them one by one to see which one is causing the problems.
Reset permalink in setting to "plain" to see whether you've configured your site properly
Your PHP version may be too low (upgrade) or the pcre.backtrack_limit is set to 100000. In order to check, create a phpinfo.php file with this
code:
<?php
// Show all information, defaults to INFO_ALL
phpinfo();
?>
And then navigate to it in your browser.
If it's low, create a php.ini file or edit the existing one and modify or add the line pcre.backtrack_limit=1000000
Check in setting->reading you're showing your latest posts (and make sure you have at least one post published (not draft). If that is the problem, and you want to show a static page, you may have a problem with the static page.
Make sure you have the latest version of Wordpress installed.
Rename your theme folder in FTP from twentysixteen to twentysixteen-temp to make sure it's not the theme.

Related

Wordpress header template not updating code

I'm working on a Wordpress theme locally. At some point all of the sudden changes to my header.php template stopped showing up on the site. A change in any other file is visible. I believe this started happening after I played around with Appeareance->Menu.
What I've done so far:
Made sure it's the right file, right path - yes
Cleared browser cache
added define( 'WP_CACHE', false ); in wp-config.php
erased all the code in the header.php file - no change, website looks normal so I undo the erase
removed get_header() from page.php - the website got ugly, put it back on - the website looks ok but still no changes visible from header.php (I have a huge <h1>blah blah</h1> in there)
rolled back a few commits back - still nothing
switched to another theme and then back to my theme - still no changes to header.php
performed rm -rf on wp-content/cache/* - still nothing
checked my theme on a different WordPress install - MY CHANGE IS VISIBLE, but I want it where it was so far so that doesn't solve my issue but it does seem to be some cache issue after all if it shows up in another install.
What else can I do? I've been out of ideas for a few days now.
I finally figured it out (actually my programming duck did). It was a plugin (Elementskit Light) causing this strange behaviour.
You might've activated the Header from ElementsKit. (https://i.imgur.com/LC2RRVu.png)
You can simply turn off the Header. (https://i.imgur.com/n8Uzxkn.png)
But if you like to keep it activated and also need some additional custom code. Then ElementsKit also provides some hooks you can use.
These hooks are:
// Before Header
do_action( 'elementskit/template/before_header' );
// After Header
do_action( 'elementskit/template/after_header' );
// Before Footer
do_action( 'elementskit/template/before_footer' );
// After Footer
do_action( 'elementskit/template/after_footer' );

wordpress output the content of a static home page instead of all available posts

I'm currently writing my first wordpress design and have some problems with the start page.
I want a static page to be the homepage. For this i made some changes to the page.php file to restructure it for the "home" page.
However when the specific page is set as start page the function
the_post()
Seems to output different results than when it's not the home page.
Used code:
while ( have_posts() ) : the_post();
get_template_part( 'template-parts/content', 'page' );
endwhile;
This part of the code loops through my poosts instead of outputting the content of my current static page - which I actually want. It somehow works when the page is not the home / start page...
The easiest would be to roll back to the original page.php, and copy the content of it into a new file named front-page.php. If present this file will always be used to display the front page. Then it's just a matter of doing all the needed modifications to this file.
As a side note; your code is working on all other pages because they are static by default.
There are also several other ways to go about this. Read more here: https://codex.wordpress.org/Creating_a_Static_Front_Page

Wordpress - Twenty Fourteen Theme - Moving Featured Content Slider to Content Area

I am using the featured content slider provided as standard in the Twenty Fourteen Wordpress theme. It's doing pretty much everything I want it to do at this point and I have done some basic customisation on it using CSS, however after speaking to a few folk internally they are looking to "insert" this into the main content area of the page.
I've had a look around, and found a suggestion to change the index.php file to change the position of the PHP statement that registers the featured content. After making these changes to my child theme and publishing them nothing happened.
I am at a complete loss as to where to look next or what to change (without trial and error which could break everything!)
It's probably a very simple solution that I'm completely overlooking so apologies if this is the case. This is an internal site so I can't provide any links unfortunately. Many thanks in advance for your help!
Index.php current code:
get_header(); ?>
<div id="main-content" class="main-content">
<div id="primary" class="content-area">
<div id="content" class="site-content" role="main">
<?php
if ( have_posts() ) :
// Start the Loop.
while ( have_posts() ) : the_post();
/*
* Include the post format-specific template for the content. If you want to
* use this in a child theme, then include a file called called content-___.php
* (where ___ is the post format) and that will be used instead.
*/
get_template_part( 'content', get_post_format() );
<?php
if ( is_front_page() && twentyfourteen_has_featured_posts() ) {
// Include the featured content template.
get_template_part( 'featured-content' );
}
?>
Further to this, the Featured Content is currently located at the top of the page and does not fit within the content and primary sidebars (it is positioned above the content sidebar to the right of the primary sidebar.
If you're worried about breaking a live site, then you should make a copy of what you've got, and install it locally on your machine.
WAMP is very good for this, if you're running Windows, and makes your computer act like an Apache web server.
Moving on from that, it would be helpful if you could provide some code, showing where your featured content slider is positioned.
And also make sure you're editing the correct file for your theme.

How to change WordPress Archive Page Title

I would like to change the text (illustrated on the image below) from 'Portfolio Archives' to 'Shop'.
I have archive.php and portfolio.php files, none of which has any obvious indication of how/where to change the text.
screen shot http://damtech.it/screen.png
Your image link is broken...
But the title usually is in your header.php file.
I also come across this problem previous week.I was using a theme.This may help you or may not.But I face same problem ,so I am answering.
If you are using some theme.Then there should be your Theme Setting.
Go to theme setting and there will be Header and footer options.You may change this text from there.My problem was solved from there.
For anyone else who wasted time trying the approved answer, reading the function reference at https://codex.wordpress.org/Function_Reference/get_header and paying attention to this section:
Multiple Headers
Different header for different pages.
<?php
if ( is_home() ) :
get_header( 'home' );
elseif ( is_404() ) :
get_header( '404' );
else :
get_header();
endif;
?>
The file names for the home and 404 headers should be header-home.php and header-404.php respectively.
leads to the following successful approach.
Copy your (yourthemename)/header.php file to (yourthemename)/header-customname.php
Change the get_header() call in the file you are targeting to get_header('customname')
Job done.

Show comments on WordPress home page

I've inserted the following code to the template loop (in the correct place), but it is not outputting any comments. Why?
<?php
$withcomments = true; // force comments form and comments to show on front page
comments_template( '', true );
?>
I'm trying to display comments for each post on the main-home-page stream of posts.
I'm using the Twenty Ten theme.
Try this before the <?php endwhile; ?> of the loop in loop.php:
<?php
$withcomments = "1";
comments_template();
?>
Try this:
<?php global $withcomments; $withcomments = 1; comments_template(); ?>
There is a much simpler way that doesn't involve editing PHP code. First make sure you can create comments on other pages and if that is working, go back to the home page.
On the top right, click the gear icon to show settings and near the bottom of settings change the "page attributes" "template" from "front page template" to "default template". Save and you will have comments.
However, you may lose other features of the home page (you can always change the template back). For me I didn't lose anything.
Understand that a normal WordPress blog is intended to have comments on the blogs (posts), but not on the home page. By default you shouldn't even have comments on any pages (just posts), but that is easily enabled. That is why normally there aren't any comments allowed, but if you have a one-page site this is a problem.
Also note that there are many different themes and some do allow comments on the home page.

Categories