Wordpress Themes - WP Forum at BFA

Wordpress Themes - WP Forum at BFA (http://forum.bytesforall.com/index.php)
-   Header configuration & styling (http://forum.bytesforall.com/forumdisplay.php?f=15)
-   -   Featured posts in horizontal bar 1 (http://forum.bytesforall.com/showthread.php?t=170)

technstuff Feb 3, 2009 12:08 AM

Featured posts in horizontal bar 1
I am trying to use horizontal bar 1 as a place to display 3 featured posts without having to hardcode the links into the theme. Here is what I have tried so far:

$horizontal_bar1 = '<div class="horbar1">
<div class="featurebox"><a href=" '. get_tag_link(9) .' ">'. get_the_excerpt(66) .'</a></div>
<div class="featurebox"><a href=" '. get_tag_link(10) .' ">Title of post here</a></div>
<div class="featurebox"><a href=" '. get_tag_link(11) .' "></a></div>

I did this in the bfa_header_config file and you can probably see that I was thinking I could use specific tags for those posts that I want to feature ("feature 1", "feature 2", etc.) and they correspond to the tag id's (9, 10, etc.). I know it probably looks pretty messy cuz I've never used php. The tag thing is working as far as getting me the link to the specific post I want to feature. But my problem is that I want to also get the post title between the <a href> and </a> using another function if possible. And then I want to take an excerpt of that same post to put below the respective titles. So far I've found that I need to get the post ID and the php functions I've found to do that need to be put into "The Loop" (scary! lol). But I don't want to hardcode the ID into this because my featured posts will change from time to time. I just want to be able to slap on a feature tag in the backend and get it to show up in the featurebox. I got this far but now I feel like I'm in way over my head. Any ideas? Thanks in advance.

Flynn Feb 3, 2009 04:11 AM

To get various info about a post (or a "Page" page) outside of the loop use

PHP Code:

$post_id $wp_query->get_queried_object_id();
$post_data get_post($post_idARRAY_A);
$post_author_id $post_data['post_author'];

$post_title $post_data['post_title'];
$post_content $post_data['post_content'];
$post_excerpt $post_data['post_excerpt'];
$post_permalink get_permalink($post_id);
$post_date $post_data['post_date'];
$post_author get_author_name($post_author_id);
$post_comment_count $post_data['comment_count']; 

Look also into bfa_postinfo.php on how to get various post related info

All times are GMT -6. The time now is 08:45 AM.

Powered by vBulletin® Copyright ©2000 - 2022, Jelsoft Enterprises Ltd.