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');
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(); ?>
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;
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.
When I'm logged in to my site, viewing an individual post, the right sidebar displays perfectly, but when I log out on the same page (via the sidebar widget), the right sidebar suddenly ends up below my comments. This only happens with I'm viewing individual posts. Any ideas what causing this?
I've double checked the CSS, and as far as I can tell being logged out doesn't add or change any class attributes. Also - the theme I'm working with doesn't have a posts.php file...
Post: http://www.wespeakfashion.com/cool-sunglasses
page.php...
<?php include (TEMPLATEPATH . '/header.php'); ?>
<div id="content">
<?php include(TEMPLATEPATH."/l_sidebar.php");?>
<div id="contentleft">
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php the_content(__('Read more'));?><div style="clear:both;"></div>
<!--
<?php trackback_rdf(); ?>
-->
<?php endwhile; else: ?>
<p><?php _e('Sorry, no posts matched your criteria.'); ?></p><?php endif; ?>
<?php posts_nav_link(' — ', __('« go back'), __('keep looking »')); ?>
</div>
<?php include(TEMPLATEPATH."/r_sidebar.php");?>
</div>
<!-- The main column ends -->
<?php get_footer(); ?>
The right sidebar appears to be in the main content div. This is suspicious because the left sidebar is a sibling of the main content div. Try taking the right sidebar out of there, and putting it as a sibling of the left sidebar and main content div.
Problem page: www.kendraschaefer.com/mandapop (problem with images in thin middle column)
Hi,
I'm working on a new Wordpress template, and I've run into an issue with Fancybox. I'm trying to get the pictures in the thin middle column of the page above to, when clicked on, pop up in fancybox with attached post data.
It's mostly working OK - on first click, no problem. Click an image, post pops up in a fancybox. But close the fancybox and try again, and you'll notice that the post loads once, then loads again. Click on aother, and this time the post loads multiple times. (Don't click too many times, your browser will freak). Sounds like a recursion problem, but I'm not sure where I'm going wrong.
I tried using other pop-up plugins, like Facebox and Lightbox, with the same problem, so it must be my loop or something. I also commented out all other javascript on the page to see if there was a conflict - still had the problem.
Here's my code (there are two loops - one for the gallery images and one for the blog entries):
<div id="homeGalleryCol">
<div id="homeGalleryContent">
<?php
query_posts('post_type=galleryimage&posts_per_page=7');
if(have_posts()) : while(have_posts()) : the_post(); ?>
<div class="singlePhotoPost">
<h3 class="galleryListDate"><?php the_time('M d'); ?></h3>
<?php the_post_thumbnail('gallery-pic-thumbnail'); ?>
</div><!-- end singlePhotoPost -->
<?php endwhile; ?>
<?php endif; ?>
</div><!-- end homeGalleryContent -->
</div><!-- end homeGalleryCol -->
<div id="thinRightCol">
<div id="rightColContent">
<div id="blogListColWrapper">
<div id="blogListCol">
<?php
query_posts('posts_per_page=3');
global $more;
$more = 0;
if(have_posts()) : while(have_posts()) : the_post(); ?>
<div class="singlePost">
<h3 class="blogListDate"><?php the_time('M d'); ?></h3>
<?php the_post_thumbnail(); ?>
<h2 class="postTitle"><?php the_title(); ?></h2>
<?php the_content('<span class="moretext"> </span>'); ?>
</div><!-- end singlePost -->
<?php endwhile; ?>
<?php endif; ?>
</div><!-- end blogListCol -->
</div><!-- end blogListColWrapper -->
</div><!-- end rightColContent -->
</div><!-- end thinRightCol -->
Thanks much.
It seems that you've removed the actual output. Can you restore it and I'll let you know what's going on? Thanks.
Try with this function <?php wp_reset_postdata(); ?>
Because this function is used to restore the global $post variable of the main query loop after a secondary query loop using new WP_Query. It restores the $post variable to the current post in the main query.
Example: http://pastebin.com/kSEg5JPg
Pay attention to <?php wp_reset_postdata(); ?>
Hope that will help you