Jump to content
Sign in to follow this  
yizhan

featured post on feature box need help

Recommended Posts

yizhan

need help, i tried to put a featured post on the feature box, thumbnails and titles are ok but the excerpt filter only affects the first post feature box.jpg and another one is the fullwidth widgets appears when i added those code in the function.php feature 2.jpg i think there something wrong with the codes

Share this post


Link to post
Share on other sites
cmunns

Are you using shortcodes? How are you entering that data into the feature boxes?

Share this post


Link to post
Share on other sites
yizhan

yes i'm using shortcodes. datas are entered as "[shortcode]" i think theres something wrong with my function.php cause it happened when i entered functions in my function.php any advise?

Share this post


Link to post
Share on other sites
bryan-hadaway

Well, you might temporarily remove the added functions to pinpoint for sure that is the problem. Then put them back one by one, I would say put them below all other code. What are the added functions purpose, perhaps I can come up with a work around for what you're trying to accomplish with the added functions. Thanks, Bryan

Share this post


Link to post
Share on other sites
yizhan

ok thanks, i have no more problem with the fullwidth widget issue.. the only problem i got is adding the excerpt here is the original code that i got from other post

function recentposts($atts, $content = null) { extract(shortcode_atts(array( "num" => '5', "cat" => '' ), $atts)); global $post; $myposts = get_posts('numberposts='.$num.'&offset=0'); foreach($myposts as $post) : setup_postdata($post); echo "<li class="list-item fix">n"; if(has_post_thumbnail()): the_post_thumbnail(array( 45, 45 ),array( 'class' => 'list_thumb list-thumb' )); else: echo "pagelines-65x65.jpgn"; endif; echo "<div class="list_item_text">n"; echo '<a class="list_text_link" href="';the_permalink(); echo '"'; echo ' <span class="list-title">'; echo $post->post_title; echo '</span>'; echo '<small><p><span class="list-describe">'; the_time(get_option('date_format')); echo ' | Komentarze (';comments_number(0, 1, '%'); echo ')</span></p></small></div>'; endforeach; } add_shortcode("recent", "recentposts");
and i want to add the excert, any idea?

Share this post


Link to post
Share on other sites
yizhan

i've tried to insert "the_excerpt();" and the filter for "read the rest." but its seem to show only in the first post.

Share this post


Link to post
Share on other sites
Andrew

In the code you're using, don't use the variable $post. It is used by everything to control normal behavior (e.g. the full width sidebar showing) Switch out '$post' for '$myrecentposts' or something like that.

Share this post


Link to post
Share on other sites
yizhan

A big THANKS!!! it works...... your great guys....

Share this post


Link to post
Share on other sites
yizhan

i notice one more problem, when i cange '$post' to 'myrecentpost' everything looks fine but the permalink is gone it always go to the home page.

Share this post


Link to post
Share on other sites
cmunns

I do not see a closing link tag in the code above. Was the permalink showing before?

Share this post


Link to post
Share on other sites
yizhan

yap the permalink is showing when i'm using the '$post" variable but when i change that to something else all permalink are directed to the home page.

Share this post


Link to post
Share on other sites
bryan-hadaway

Try places a } at the very bottom of your code. Thanks, Bryan

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

×