treehouse : what would you like to learn today?
Web Design Web Development iOS Development

[Solved] I need a genius or wizard, Anyone?

  • Hey guys,

    I can't figure out why my site isn't showing the full content of the page. The site is built on Wordpress. It use to work perfectly but now it isn't. It isn't just a problem with this page it is the whole category, none of the "posts" listed under the "specials" category are showing up.

    This is what I mean. scroll to the footer of the page and click on the first post under "Marty's Specials"

    Let's see what level of skill there is out there... (I bet I'm setting myself up to find out it's an extremely simple fix, that's ok though because I can't figure it out myself)
  • I'm guessing your single.php file isn't including the proper files.
  • I'm guessing it's the PDf 24 plugin that is active on this page, or a problem with the actual content on it: http://www.metalmart.biz/building-this-spring/

    This post works fine: http://www.metalmart.biz/metal-roof-hemming-a-panel-video/ which leads me to believe there's nothing wrong with single.php (or loop-single.php)
  • Still not understanding the problem.
  • The admin edit bar doesn't even show up at the top of these pages when I'm signed in. It's very strange. I really need help...anyone?
  • Did you try disabling the PDF24 plugin?
  • @Senff yes, I tried that and it didn't do anything. I'm kinda stuck.
  • Please post your single.php.
  • @TheDoc Here it is

    <?php
    $post = $wp_query->post;
    if ( in_category('8') ) {
    include(STYLESHEETPATH . '/single-salesProfile.php');

    }
    else if ( in_category('20') ) {
    include(STYLESHEETPATH . '/single-blog.php');
    }
    else if ( in_category('7') ) {
    include(STYLESHEETPATH . '/single-specials.php');
    }

    else {
    include(STYLESHEETPATH . '/single-main.php');
    }
    ?>

  • And here is the single-specials.php

    <?php

    //Retrieve all admin options
    global $options;
    foreach ($options as $value) {
    if (get_option( $value['id'] ) === FALSE) {
    $$value['id'] = $value['std'];
    } else {
    $$value['id'] = get_option( $value['id'] );
    }
    }

    ?>

    <?php get_header(); ?>

    <!-- PRIMARY CONTENT (start) -->

    <div id="primary" class="ie6">

    <?php if($jbobich_sidebar == 'true') : ?>
    <?php get_sidebar(); ?>
    <?php endif; ?>

    <div id="content">
    <div class="pad">
    <?php the_post(); ?>

    <div class="single" id="post-<?php the_ID(); ?>">

    <h2 class="page-title"><?php the_title(); ?> <span><?php pdf24Plugin_link('Print Ad'); ?></span></h2>

    <span class="author-box">
    <span class="date"><strong>Posted:</strong> <?php the_time('m/d/y'); ?> <?php echo expireDate(); ?> <?php echo daysLeft(); ?></span>
    <a href="<?php the_permalink(); ?>#comments-wrap" class="comments-link"><?php comments_number('No Comments', '1 Comment', '% Comments'); ?></a>
    </span>

    <!-- Post Content -->
    <?php the_content(); ?>
    <?php pdf24Plugin_topBottom(); ?>

    <h3 style="color:red; margin: 30px 0px 0px 0px; padding:0px;">IMPORTANT NOTICE:</h3>
    <p style="margin:0px; padding:0px;">To better serve you, our customer, please call for current availability of inventory.<br />
    <strong>Quantities change hourly. Inventory quantities are correct as of date posted.</strong> Prices listed are FOB: METALMART Lehi, Utah-Cash &amp; Carry only. Delivery is available and can be arranged at additional cost. The flyer must be presented to cashier at time of purchase. Items are sold "AS-IS". PRICES SUBJECT TO CHANGE AT ANY TIME WITHOUT ANY PRIOR NOTICE; THE PRICES IN THE AD WILL BECOME INVALID. FOR ACCURATE PRICING, PLEASE CALL TO VERIFY PRICE AND QUANTITIES. A MINIMUM ORDER MAY BE REQUIRED ON SOME ITEMS.</p>

    </div><!-- .single (end) -->

    <!-- Comments -->
    <?php comments_template('', true); ?>

    </div><!-- .pad (end) -->
    </div><!-- #content (end) -->

    <?php if($jbobich_sidebar == 'false') : ?>
    <?php get_sidebar(); ?>
    <?php endif; ?>

    <?php get_footer(); ?>
  • Is this proper code in single-specials.php?

    <?= expireDate(); ?> <? daysLeft(); ?>
    I'm not a PHP expert so <?= may be a way of writing things that's unknown to me, but I'm pretty that's where the problem is and that you intended to write something like this:

    <?php echo expireDate(); ?> <?php echo daysLeft(); ?>
  • I think Senff has got it!
  • That didn't do it :( so sad.
  • Maybe those variables aren't defined, remove them to check what happens.... Change this:

    <span class="date"><strong>Posted:</strong> <?php the_time('m/d/y'); ?>  <?php echo expireDate(); ?> <?php echo daysLeft(); ?></span>
    Into this:

    <span class="date"><strong>Posted:</strong> <?php the_time('m/d/y'); ?></span>
  • @Senff you win the genius/wizard award. That did it. You are the man. Thank you so much for giving me the fix. I owe you one.
  • @Senff sorry, you still get the award in my opinion but it's not showing in IE...go figure. Anyone have any ideas? You can see what it is supposed to look like in Firefox.
    Here's an example
  • First of all, I would resize/reduce the image on that page: http://www.metalmart.biz/wp-content/uploads/2012/05/flyer-special_4.jpg -- you really don't need a 2550x3300 / 4MB image for that.

    Second, if you look in the source code, you'll see that the image has an empty height (height=""):

    <img src="http://www.metalmart.biz/wp-cont...cial_4.jpg&quot; alt="" title="flyer-special_4" width="930" height="" class="aligncenter size-full wp-image-4976" />
    All browsers ignore that error, but IE doesn't. Not sure how it got there, did you use the standard Wordpress image uploader and then removed the height value in the properties window?

  • @Senff Thanks I didn't know that about IE. Since you're so good at this, could you take a look at one more thing for me. If you go to the same site and click the "Specials" button in the header menu, you can see that it doesn't work either. I think this all happened when I updated the theme a couple weeks ago.

    *EDIT*
    It only shows one post available. I'm not sure what the problem is.
  • Can you post the contents of your loop.php file please?
  • @Senff
    Here it is, I appreciate you helping me, I'm totally a newbie.


    <?php /* Display navigation to next/previous pages when applicable */ ?>
    <?php if ( $wp_query->max_num_pages > 1 ) : ?>

    <?php next_posts_link( __( '<span class="meta-nav">← Older posts', 'twentyten' ) ); ?>
    <?php previous_posts_link( __( 'Newer posts <span class="meta-nav">→', 'twentyten' ) ); ?>

    <?php endif; ?>

    <?php /* If there are no posts to display, such as an empty archive page */ ?>
    <?php if ( ! have_posts() ) : ?>

    <?php _e( 'Not Found', 'twentyten' ); ?>

    <?php _e( 'Apologies, but no results were found for the requested archive. Perhaps searching will help find a related post.', 'twentyten' ); ?>
    <?php get_search_form(); ?>


    <?php endif; ?>

    <?php<br /> /* Start the Loop.
    *
    * In Twenty Ten we use the same loop in multiple contexts.
    * It is broken into three main parts: when we're displaying
    * posts that are in the gallery category, when we're displaying
    * posts in the asides category, and finally all other posts.
    *
    * Additionally, we sometimes check for whether we are on an
    * archive page, a search page, etc., allowing for small differences
    * in the loop on each template without actually duplicating
    * the rest of the loop that is shared.
    *
    * Without further ado, the loop:
    */ ?>
    <?php while ( have_posts() ) : the_post(); ?>

    <?php /* How to display posts of the Gallery format. The gallery category is the old way. */ ?>

    <?php if ( ( function_exists( 'get_post_format' ) && 'gallery' == get_post_format( $post->ID ) ) || in_category( _x( 'gallery', 'gallery category slug', 'twentyten' ) ) ) : ?>
    " <?php post_class(); ?>>
    " title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?>


    <?php twentyten_posted_on(); ?>



    <?php if ( post_password_required() ) : ?>
    <?php the_content(); ?>
    <?php else : ?>
    <?php<br /> $images = get_children( array( 'post_parent' => $post->ID, 'post_type' => 'attachment', 'post_mime_type' => 'image', 'orderby' => 'menu_order', 'order' => 'ASC', 'numberposts' => 999 ) );
    if ( $images ) :
    $total_images = count( $images );
    $image = array_shift( $images );
    $image_img_tag = wp_get_attachment_image( $image->ID, 'thumbnail' );
    ?>

    "><?php echo $image_img_tag; ?>

    <?php printf( _n( 'This gallery contains <a %1$s>%2$s photo.', 'This gallery contains %2$s photos.', $total_images, 'twentyten' ),
    'href="' . get_permalink() . '" title="' . sprintf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ) . '" rel="bookmark"',
    number_format_i18n( $total_images )
    ); ?>

    <?php endif; ?>
    <?php the_excerpt(); ?>
    <?php endif; ?>



    <?php if ( function_exists( 'get_post_format' ) && 'gallery' == get_post_format( $post->ID ) ) : ?>
    " title="<?php esc_attr_e( 'View Galleries', 'twentyten' ); ?>"><?php _e( 'More Galleries', 'twentyten' ); ?>
    |
    <?php elseif ( in_category( _x( 'gallery', 'gallery category slug', 'twentyten' ) ) ) : ?>
    " title="<?php esc_attr_e( 'View posts in the Gallery category', 'twentyten' ); ?>"><?php _e( 'More Galleries', 'twentyten' ); ?>
    |
    <?php endif; ?>
    <?php comments_popup_link( __( 'Leave a comment', 'twentyten' ), __( '1 Comment', 'twentyten' ), __( '% Comments', 'twentyten' ) ); ?>
    <?php edit_post_link( __( 'Edit', 'twentyten' ), '<span class="meta-sep">| ', '' ); ?>



    <?php /* How to display posts of the Aside format. The asides category is the old way. */ ?>

    <?php elseif ( ( function_exists( 'get_post_format' ) && 'aside' == get_post_format( $post->ID ) ) || in_category( _x( 'asides', 'asides category slug', 'twentyten' ) ) ) : ?>
    " <?php post_class(); ?>>

    <?php if ( is_archive() || is_search() ) : // Display excerpts for archives and search. ?>

    <?php the_excerpt(); ?>

    <?php else : ?>

    <?php the_content( __( 'Continue reading <span class="meta-nav">→', 'twentyten' ) ); ?>

    <?php endif; ?>


    <?php twentyten_posted_on(); ?>
    |
    <?php comments_popup_link( __( 'Leave a comment', 'twentyten' ), __( '1 Comment', 'twentyten' ), __( '% Comments', 'twentyten' ) ); ?>
    <?php edit_post_link( __( 'Edit', 'twentyten' ), '<span class="meta-sep">| ', '' ); ?>



    <?php /* How to display all other posts. */ ?>

    <?php else : ?>
    " <?php post_class(); ?>>
    " title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?>


    <?php twentyten_posted_on(); ?>


    <?php if ( is_archive() || is_search() ) : // Only display excerpts for archives and search. ?>

    <?php the_excerpt(); ?>

    <?php else : ?>

    <?php the_content( __( 'Continue reading <span class="meta-nav">→', 'twentyten' ) ); ?>
    <?php wp_link_pages( array( 'before' => '' . __( 'Pages:', 'twentyten' ), 'after' => '' ) ); ?>

    <?php endif; ?>

    <?php if ( count( get_the_category() ) ) : ?>

    <?php printf( __( '<span class="%1$s">Posted in
    %2$s', 'twentyten' ), 'entry-utility-prep entry-utility-prep-cat-links', get_the_category_list( ', ' ) ); ?>

    |
    <?php endif; ?>
    <?php<br /> $tags_list = get_the_tag_list( '', ', ' );
    if ( $tags_list ):
    ?>

    <?php printf( __( '<span class="%1$s">Tagged
    %2$s', 'twentyten' ), 'entry-utility-prep entry-utility-prep-tag-links', $tags_list ); ?>

    |
    <?php endif; ?>
    <?php comments_popup_link( __( 'Leave a comment', 'twentyten' ), __( '1 Comment', 'twentyten' ), __( '% Comments', 'twentyten' ) ); ?>
    <?php edit_post_link( __( 'Edit', 'twentyten' ), '<span class="meta-sep">| ', '' ); ?>



    <?php comments_template( '', true ); ?>

    <?php endif; // This was the if statement that broke the loop into three parts based on categories. ?>

    <?php endwhile; // End the loop. Whew. ?>
  • Sorry it was too long to include in one post, here's the rest.


    <?php /* Display navigation to next/previous pages when applicable */ ?>
    <?php if ( $wp_query->max_num_pages > 1 ) : ?>
    <div id="nav-below" class="navigation">
    <div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">&larr;</span> Older posts', 'twentyten' ) ); ?></div>
    <div class="nav-next"><?php previous_posts_link( __( 'Newer posts <span class="meta-nav">&rarr;</span>', 'twentyten' ) ); ?></div>
    </div><!-- #nav-below -->
    <?php endif; ?>

  • I am not great with PHP yet
  • @Senff thanks again for your help. I found the other problem. It was in my category-7.php it took a while to figure out but it was just a matter of deleting the same text as from the single-specials.php so thanks for your help.
  • Anytime, glad you got it all working now!