Basiclly, this is my index.php code:
<?php
get_header();
?>
<!-- WRAPPER START -->
<section id="wrapper">
<!-- START DYNAMIC PART -->
<?php
if(have_posts()):
while(have_posts()):
the_post();
?>
<!-- MAIN CONTENT START-->
<section id="main-content">
<!-- SIDEBAR START -->
<aside id="tab-lists">
<?php if(!dynamic_sidebar('telerik-sidebar')): ?>
<?php endif; ?>
<?php if(!dynamic_sidebar('telerik-sidebar2')): ?>
<?php endif; ?>
</aside>
<!-- SIDEBAR END -->
<!-- BIG POST START -->
<div id="big-post">
<article>
<header>
<h2>
<?php the_title(); ?>
</h2>
<p class="post-info">
Posted by <?php the_author(); ?> in on <?php the_date('d-m-Y'); ?> | <?php comments_number( 'no comment', 'one comment', '% comments' ); ?>
</p>
</header>
<?php the_post_thumbnail(); ?>
<div class="post-text">
<?php the_content(); ?>
</div>
</article>
</div>
<!-- BIG POST END -->
<div id="com">
<?php
comments_template('',true);
?>
</div>
</section>
<!-- MAIN CONTENT END -->
<?php
endwhile;
endif;
?>
<!-- END DYNAMIC PART -->
</section>
<!-- WRAPPER END -->
<?php
get_footer();
?>
It worked perfect on my localhost, but when I uploaded it into wordpress I get the Notice: Theme without comments.php is deprecated since version 3.0 with no alternative available. Please include a comments.php template in your theme. in /f5/funkz/public/wp-includes/functions.php on line 2670 - error, so i made a comments.php, and put the just my comments_template('',true); in there (in php tags) and on his place in the index.php i placed comments_template(); to call the file, but then i get memory issue error...I read in some places that can be resolved by increasing it in php.ini , but I didn't find it in my server's folders :( . If you have a solution thank you in advance.
Just use
<?php comments_template( '/templates/comments.php', true ); ?>
and move comments.php in to dir templates.
If you used the 2012 comments.php template, make sure that it is not looking from the line:
#package Wordpress, #subpackage TwentyTwelve #since v1.0.
Related
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(); ?>
Below you can see my home page template. I used to have this line in the content of my page, it loads the thumbnail and the video player with video. I now want to have this in a template but i dont know how to call it properly. You can see I am trying to call the video from my theme options panel.
Before
[KGVID poster="http://www.muratgokmen.co.uk/wp-content/uploads/2013/09/thumbnail-home.jpg" width="1005" height="565"]http://www.muratgokmen.co.uk/wp-content/uploads/2013/09/sample.mp4[/KGVID]
After
[KGVID poster="http://www.muratgokmen.co.uk/wp-content/uploads/2013/09/thumbnail-home.jpg" width="1005" height="565"]http://www.muratgokmen.co.uk/wp-content/uploads/2013/09/sample.mp4[/KGVID]
Any help would be much appreciated.
<?php /* Template Name: Home Page */ get_header(); ?>
<!-- section -->
<section role="main">
<?php if (have_posts()): while (have_posts()) : the_post(); ?>
<!-- article -->
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
[KGVID poster="http://www.muratgokmen.co.uk/wp-content/uploads/2013/09/thumbnail-home.jpg" width="1005" height="565"]<?php echo $smof_data['home-page-video-url'];?>[/KGVID]
</article>
<!-- /article -->
<?php endwhile; ?>
<?php else: ?>
<!-- article -->
<article>
<h2><?php _e( 'Sorry, nothing to display.', 'html5blank' ); ?></h2>
</article>
<!-- /article -->
<?php endif; ?>
</section>
<!-- /section -->
<?php get_footer(); ?>
For using shortcode in templates do this
<?php echo do_shortcode("[KGVID poster='http://www.muratgokmen.co.uk/wp-content/uploads/2013/09/thumbnail-home.jpg' width='1005"' height='565']http://www.muratgokmen.co.uk/wp-content/uploads/2013/09/sample.mp4[/KGVID]"); ?>
I am trying to modify a child theme based on wp-foundation and I'm trying to edit the front page.
This is the front page code in the main theme;
<?php
/*
Template Name: Homepage
*/
?>
<?php get_header(); ?>
<div id="content">
<div id="main" class="twelve columns" role="main">
<article role="article">
<?php
$orbit_slider = of_get_option('orbit_slider');
if ($orbit_slider){
?>
<header>
<div id="featured">
</div>
</header>
<?php } ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<section class="row post_content">
<div class="home-main eight columns">
<?php the_content(); ?>
</div>
</section> <!-- end article header -->
<footer>
<p class="clearfix"><?php the_tags('<span class="tags">Tags: ', ', ', '</span>'); ?></p>
</footer> <!-- end article footer -->
</article> <!-- end article -->
<?php
// No comments on homepage
//comments_template();
?>
<?php endwhile; ?>
</article>
<?php endif; ?>
</div> <!-- end #main -->
</div> <!-- end #content -->
<?php get_footer(); ?>
Whenever I try to delete some code (I want to get rid of the built in orbit slider and use a plugin for example) but when I delete this piece;
<?php
$orbit_slider = of_get_option('orbit_slider');
if ($orbit_slider){
?>
The page just goes blank. I thought I was doing this in a 'clean' way, though I am not so familiar with PHP so I don't get why the page goes blank. I want to delete more of the php codes (basically I want a clean empty page to start with.) but they all give the same result; a blank page.
Why can't I just remove these pieces, why does this error occur?
May be you have removed if ($orbit_slider){, but you have left the closing curly brace <?php } ?>
Remove that line just after the header closing tag.
</header>
remove this ----> <?php } ?>
in your wp-config.php look for
define('WP_DEBUG', false);
and replace it with
define('WP_DEBUG', true);
which will show errors instead of blank screen (only for development)
for this piece of code you are getting error because
if ($orbit_slider){
starts an if loop. try removing only
$orbit_slider = of_get_option('orbit_slider');
I'm struggling with getting wordpress to search custom post meta from a page template. I've looked all over the internet and can't seem to find anything that will work. No plugins seem to work either.
On my posts, I have the custom meta: "rate" and the value: "10" - Wordpress delivers no result when searching any of these.
I'd be very appreciated if someone could write me a searchpage.php page template or point me in the right direction (I'm not good with php).
Here's my current PHP code:
<?php
/*
Template Name: Search Custom Meta
*/
?>
<?php get_header(); ?>
<div id="content">
<div class="container clearfix fullwidth">
<div id="left-area">
<?php query_posts('meta_value='.$s); ?>
<?php if (!empty($wp_query->posts)) : ?>
<?php while (have_posts()) : the_post(); ?>
<?php endwhile; ?>
<?php else : ?>
<?php endif; ?>
</div> <!-- end #left-area -->
</div> <!-- .container -->
</div> <!-- #content -->
<?php get_footer(); ?>
You checking incorrect variable in if so try removing that one,
query_posts('meta_value='.$s);
while ( have_posts() ) : the_post();
echo '<li>';
the_title();
echo '</li>';
endwhile;
I am needing some serious Wordpress expertise from others. I am in the process of building a custom theme, read about the get_template_part() method and decided that would help in cleaning up and organizing my code. I updated my theme to use this method several places and now the site is completely broken...not a single thing will load!! :( I would really appreciate any help! I will copy and paste a few of the php files below. Maybe someone with more experience with using this method can point out the problem. THANKS!
page.php
<?php get_header(); ?>
<div id="content" class="content">
<?php while ( have_posts() ) : the_post(); ?>
<!-- About page -->
<?php if (is_page('about')) ?>
<?php get_template_part( 'page', 'about' ); ?>
<!-- Media & Gallery page -->
<?php if (is_page('media-gallery')) ?>
<?php get_template_part( 'page', 'mediagallery' ); ?>
<?php endwhile; // end of the loop. ?>
</div> <!--/end content -->
<?php get_footer(); ?>
page-about.php
<div id="about">
<div class="text">
<h2 class="about"><?php echo get_the_title(); ?></h2>
<?php the_content(); ?>
</div>
</div>
page-mediagallery.php
<div id="pic-gallery">
<?php include_once 'includes/pwaplusphp/albums.php'; ?>
</div>
index.php
<?php get_header(); ?>
<div class="content">
<?php if ( have_posts() ) : ?>
<?php while ( have_posts() ) : the_post(); ?>
<?php get_template_part( 'content', get_post_format() ); ?>
<br class="clr"/>
<?php endwhile; ?>
<?php content_nav( 'nav-below' ); ?>
<?php else : ?>
<article id="post-0" class="post no-results not-found">
<header class="entry-header">
<h3 class="blog"><?php _e( 'Nothing Found' ); ?></h3>
</header> <!-- .entry-header -->
<div class="entry-content">
<p><?php _e( 'Apologies, but no results were found for the requested archive. Perhaps searching will help find a related post.'); ?></p>
</div> <!-- .entry-content -->
</article> <!-- #post-0 -->
<?php endif; ?>
</div> <!--/end content -->
<?php get_footer(); ?>
content-gallery.php
<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<div class="post-date"><?php the_time(get_option('date_format')); ?></div>
<h3 class="blog"><?php the_title(); ?></h3>
<div class="post-content"><?php the_content(); ?></div>
</div>
Any thoughts why these may not be working? All of these files are under the root directory of the theme so the get_template_part() method should be finding all of the files. What's weird is no code is being spit out by Wordpress. aka. Since I've started using this method, not a single line of code is spit out in my browser when I inspect the source.
I am using the newest version of Wordpress and Google Chrome for my browser.
I also have this code at the top of each of my .php files, but that shouldn't mess up anything because it's commented as seen below:
<?php
/**
* I put a description of what the file does here.
*
* #package Keynote_WP_Themes
* #subpackage Rhymz_Suhreal
* #copyright Rhymz Suhreal, 2012
* #author Kyle Affolder <myemail#example.com>
*/
?>
I don't have the slightest clue as to what I'm doing wrong. :(
Ideas coding friends?!
Using your page-about.php as an example, you should be calling it like this in the template it's to be place in:
<?php get_template_part( "page-about" ); ?>
The template needs to be in the root of your theme directory so you can use "page-about" without the .php, and not have to indicate the location/directory the file would otherwise be located.
I've run into this a few times before as well - I can't really explain why yet as I'm still digging through the documentation, but it seems you can't call template parts this way when you are inside a post loop ;)
Anytime you are inside the loop, try using this instead:
<?php include(get_query_template('page-about')); ?>