logo
Ask your WordPress questions! Pay money and get answers fast! (more info)

Warning: Please do not give out any FTP or ssh credentials to anyone, unless you trust them completely. Giving out login details is dangerous.

If the asker does not get an answer then they have 10 days to request a refund.

$15
Show specific post content on main page - excerpt or what?

Hello,
I have a video site in which the main page has a list of images (featured image) and titles that link to the posts. A single image and text to the corresponding post.

In the post is the video embed (top) and just underneath is a table with 3 caption pic of the video.
<div align="center"><table width="784" cellspacing="8" bgcolor="#5E005E"><tr>
<td><img style="border:1px solid black;" src="/wp-content/uploads/01.jpg" height="150" width="250"></td>
<td><img style="border:1px solid black;" src="/wp-content/uploads/02.jpg" height="150" width="250"></td>
<td><img style="border:1px solid black;" src="/wp-content/uploads/03.jpg" height="150" width="250"></td>
</tr></table></div>


I've decided I would like use the above table for the 'feature' on the main page instead of the single image.
such as:
		<div <?php post_class() ?> id="post-<?php the_ID(); ?>">
<div class="posttitle"><a href="<?php the_permalink() ?>" target="_blank"><?php the_title(); ?></a></div>
<div class="entry">
<?php the_excerpt(); ?>
</div>
<div class="postmetadata">
<div id="category"><?php the_category(' ') ?></div>
<div id="datemeta"><?php the_time('jS F, Y') ?></div>
<div id="readmore"><a href="<?php the_permalink() ?>" target="_blank">see more</a></div><div class="clear"></div>
</div>
</div>


Tried <!--more--> for excerpt but I would have to put the table at the top and not underneath the video embed as I want it.
Tried placing the table in the excerpt function but its 'disjointed' from the rest of the post body and content.

How do I get it in there without altering the post design?

Thanks

ajay300 | 02/04/13 at 8:17am Edit
Tutorial: How to assign prize money


(15) Responses

See a threaded view of answers?

Warning: Please do not give out any FTP or ssh credentials to anyone, unless you trust them completely. Giving out login details is dangerous.

  • avatar
    Last edited:
    02/04/13
    8:33am
    Trevor Green says:

    Not entirely clear without a link to the site. You are putting code up here? Are you comfortable editing templates as a solution?

  • avatar
    Last edited:
    02/04/13
    8:41am
    Arnav Joy says:

    can you explain about your question more , it is not clear

  • avatar
    Last edited:
    02/04/13
    9:51am
    Ellah Alzona says:

    kindly show us the index.php and single php to understand more your problem and what you want to do.

  • avatar
    Last edited:
    02/04/13
    8:43am
    Arnav Joy says:

    can you show index.php code and single.php code

  • avatar
    Last edited:
    02/04/13
    8:48am
    ajay300 says:

    "Are you comfortable editing templates as a solution?"
    yes
    The second code which is placed in the main index and category pages works good. I've placed the table within the excerpt function (edit post)and it was correctly showing(main page).
    I just cant get it to work without altering the post its self which I dont want to do.

  • avatar
    Last edited:
    02/04/13
    8:52am
    Trevor Green says:

    Well the table doesn't look like a dynamic piece and it sounds like that is what you want to move.

    Did you consider using a function and/or short code stuck in your functions.php in your theme to output that table where you want it?

    Or widgetizing the area in your theme where you want it and just add the table to a html widget.

    So there is 3 options to make it a modular piece that you can deploy wherever you like.

  • avatar
    Last edited:
    02/04/13
    8:52am
    Trevor Green says:

    Well the table doesn't look like a dynamic piece and it sounds like that is what you want to move.

    Did you consider using a function and/or short code stuck in your functions.php in your theme to output that table where you want it?

    Or widgetizing the area in your theme where you want it and just add the table to a html widget.

    So there is 3 options to make it a modular piece that you can deploy wherever you like.

  • avatar
    Last edited:
    02/04/13
    9:03am
    ajay300 says:

    post with the 3 pic purple border table.
    (not placed in excerpt function)

    attachment image expert uploaded image

  • avatar
    Last edited:
    02/04/13
    9:04am
    ajay300 says:

    post with the 3 pic purple border table.
    (placed in excerpt function)

    attachment image expert uploaded image

  • avatar
    Last edited:
    02/04/13
    10:05am
    Ellah Alzona says:

    Just incase you need a code to your problem im pasting it below. Might help.

    If you want to post a specific POST in your main page try this code below:


    <?php $blog_query = 'showposts=1&cat=5&paged='.$paged;
    $posts = query_posts($blog_query);
    while (have_posts()) : the_post(); ?>
    <span id="post-<?php the_ID(); ?>">
    <a href="<?php the_permalink(); ?>" rel="bookmark">
    <?php the_title(); ?></a></h2>
    <?php the_excerpt(); ?>
    <?php endwhile; ?>


    Change the "cat=5" to the category of your desired POST.

    While if you want to get the content of a specific PAGE try this code below.


    <?php $blog_query = 'page_id=174&paged='.$paged;
    $posts = query_posts($blog_query);
    while (have_posts()) : the_post(); ?>
    <h3 class="widgettitle" id="post-<?php the_ID(); ?>">

    <a href="<?php the_permalink(); ?>"
    rel="bookmark">
    <?php the_title(); ?></a></h3>
    <div class="featured">
    <?php
    if ( has_post_thumbnail() ) {
    the_post_thumbnail();
    }
    else
    echo '';
    ?>
    </div>
    <?php the_excerpt(); ?>
    <?php endwhile; ?>


    Change the value of "page_id=174" to the id of the page you want to feature into something like "page_id=4"

    I hope atleast this helps get a little idea to solve your problem.

  • avatar
    Last edited:
    02/05/13
    7:58am
    ajay300 says:

    single.php

    <?php get_header(); ?>
    <div id="content">
    <div class="postsbody">

    <? global $options;
    foreach ($options as $value) {
    if (get_settings( $value['id'] ) === FALSE) { $$value['id'] = $value['std']; } else { $$value['id'] = get_settings( $value['id'] ); }
    }
    ?>

    <div class="featured2">
    <h2><?php the_title(); ?></h2>
    <div style="padding:0px 0 10px 0px;">
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    <div class="fpost">

    <div class="embed">
    <?php echo get_post_meta($post->ID, "embed", true); ?>
    </div>
    <?php the_content('<p class="serif">Read the rest of this page &raquo;</p>'); ?>
    <?php wp_link_pages(array('before' => '<p>Pages: ', 'after' => '</p>', 'next_or_number' => 'number')); ?>
    </div>
    <div class="pviews">
    <div class="pratings">Rate this post: <?php if(function_exists('the_ratings')) { the_ratings(Ratings); } ?></div>
    <div style="text-align:right;"><?php if(function_exists('the_views')) { the_views(); } ?></div>
    </div>

    <div align="center">
    <?php if (function_exists('sociable_html')) {
    echo sociable_html();
    } ?>
    </div>

    <?php endwhile; endif; ?>
    </div>
    </div>
    </div>

    <?php include (TEMPLATEPATH . '/sidebar_right_2.php'); ?>
    </div>

    <?php get_footer(); ?>

  • avatar
    Last edited:
    02/05/13
    8:03am
    ajay300 says:

    index.php

    <?php get_header(); ?>
    <div class="content-head">

    <div class="banner"><img src="/wp-content/uploads/banner.jpg" width="784"/></div>

    <div class="latestof"> <h2></h2>
    <ul>
    <?php $recent = new WP_Query("cat=-<? echo $wt_featured; ?>&showposts=3"); while($recent->have_posts()) : $recent->the_post();?>

    <li>
    <div class="date"><?php the_time('F jS, Y') ?></div>
    <h5><a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h5>
    </li>

    <?php endwhile; ?>
    </ul></div>
    </div>


    <div class="postsbody">


    <h1></h1>


    <div style="clear:both;"></div>


    <h3></h3>


    <div class="featured">


    <div style="padding:15px 0 15px 10px;">

    <?php if( get_query_var( 'paged' ) )
    $my_page = get_query_var( 'paged' );
    else
    $my_page = 1; $recent = new WP_Query("cat=-".$wt_featured."&showposts=30 &paged=".$my_page); while($recent->have_posts()) : $recent->the_post();?>



    <?php //$recent = new WP_Query("cat=-<? echo $wt_featured; &showposts=24"); while($recent->have_posts()) : $recent->the_post();?>
    <div class="videopart">

    <div class="thumbnail">
    <a title="<?php the_title(); ?>" href="<?php the_permalink(); ?>" target="_blank"><?php the_post_thumbnail(); ?></a>
    </div>

    <div class="fpost">

    <h3><a href="<?php the_permalink() ?>" target="_blank" title="<?php the_title(); ?>"><?php the_title(); ?></a></h3>
    </div>
    </div>

    <?php endwhile; ?>
    </div>
    </div>

    <?php if(function_exists('wp_pagenavi')) { wp_pagenavi(); } ?>
    </div>

    <?php include (TEMPLATEPATH . '/sidebar_right.php'); ?>


    <?php get_footer(); ?>

  • avatar
    Last edited:
    02/05/13
    8:31am
    ajay300 says:

    http://digitalraindrops.net/2012/03/understanding-wordpress-excerpts/
    I want the table below to be the excerpt.

    [user_has_access][jwplayer config="custom01" file="/wp-content/uploads/user_uploads/G-luv/How%20to%20glam%20up%20your%20everyday%20makeup.flv" image="/wp-content/uploads/016.jpg"][/user_has_access]

    [no_access]
    <div align="center"><a href="/registration/" target="_blank">
    <img src="/wp-content/uploads/elephant-2.jpg" /></a></div>
    [/no_access]

    <div align="center"><table width="784" cellspacing="8" bgcolor="#5E005E"><tr>

    <td><img style="border:1px solid black;" src="/wp-content/uploads/01.jpg" height="150" width="250"></td>

    <td><img style="border:1px solid black;" src="/wp-content/uploads/02.jpg" height="150" width="250"></td>

    <td><img style="border:1px solid black;" src="/wp-content/uploads/03.jpg" height="150" width="250"></td>

    </tr></table></div>



  • avatar
    Last edited:
    02/05/13
    6:04pm
    Ellah Alzona says:

    I am afraid we cannot show a table in an excerpt

  • avatar
    Last edited:
    02/05/13
    6:06pm
    Ellah Alzona says:

    Why not use a function to widgetize it.
    So you can add a content on your widget area and show them in your template to make it simplier.

This question has expired.





Current status of this question: Community pot



Please log in to add additional discourse to this page.





Warning: Please do not give out any FTP or ssh credentials to anyone, unless you trust them completely. Giving out login details is dangerous.

If the asker does not get an answer then they have 10 days to request a refund.