Jump to content
Sign in to follow this  
jonny41891

Featured/Trending posts like mashable

Recommended Posts

jonny41891

Is there anyway I can get "Featured/Trending" posts at the top like mashable.com ... I'm using platform pro theme.. thanks in advance

Share this post


Link to post
Share on other sites
kastelic

For this you would need a plugin. Try searching for "featured posts" in the plugin repository.

Share this post


Link to post
Share on other sites
jonny41891

Hey Jimmy, thanks for the reply.. I can't quite seem to find one the will display one big feature post to the top left and 2 mini feature posts to the right like mashables.. does anyone have any more suggestions?

Share this post


Link to post
Share on other sites
jonny41891

I am a novice, does anyone have a easier way or can anyone help me out?

Share this post


Link to post
Share on other sites
catrina

If you are not familiar with hooks, the video tutorial should help: http://www.pagelines.com/docs/base-child-theme To explain further, a hook is a code inside the theme that allows you to place a certain element (whether it's an image or block of text) in a certain place. You choose a hook from the lists available (in Template Setup) depending on which section of the site you want to put your custom content in. For example, if you want your custom content to be after a single post, you'll choose a hook that is located after that single post. Once it's chosen, you can set up the hook in the function.php file. Does that make sense so far?


Please read the docs before posting. Please do not private message me unless I ask you to.

Designer | Catrina Dulay

Founder | Catrina and Mouse

Share this post


Link to post
Share on other sites
jonny41891

Hey Catrina, yes I am very familar with hooks and find it very convenient and love it. The only problem is that I just don't know where to begin with a this, could you please shed some light? Thanks in advance :)

Share this post


Link to post
Share on other sites
catrina
http://codex.wordpress.org/Class_Reference/WP_Query#Order_.26_Orderby_Parameters <- In this section there is a query for "Show popular posts" (popular posts are displayed in order by comment count) Is this what you're looking for in terms of a "featured" post?

Please read the docs before posting. Please do not private message me unless I ask you to.

Designer | Catrina Dulay

Founder | Catrina and Mouse

Share this post


Link to post
Share on other sites
jonny41891

I would like to choose what posts to display manually

Share this post


Link to post
Share on other sites
jonny41891

I would like to chose the 3 "featured/highlight/sticky" posts manually and display it similarly to mashable.. also, I think this thread would also help others too and hope it isn't too difficult

Share this post


Link to post
Share on other sites
catrina

Ah, I see. I think it'd be easier if, say, you created a category JUST for Featured posts. For example, you can create a category called "Featured" and add the featured posts you want to that category. Once that's set up, you can set up a hook that displays the 3 posts from that category. You can keep changing what posts go into that category so only what posts you want can display.


Please read the docs before posting. Please do not private message me unless I ask you to.

Designer | Catrina Dulay

Founder | Catrina and Mouse

Share this post


Link to post
Share on other sites
jonny41891

Exactly Catrina, I have the category set up a (FeaturedPosts), now I just need to know where to start setting it up using the hooks and also, I'm going to have to play around the css too, correct?

Share this post


Link to post
Share on other sites
catrina

The CSS can be implemented last (once the hook is set up). Where exactly do you want these featured posts to display (directly above the posts in the main column)?


Please read the docs before posting. Please do not private message me unless I ask you to.

Designer | Catrina Dulay

Founder | Catrina and Mouse

Share this post


Link to post
Share on other sites
jonny41891

Yes, almost identical to mashable's

Share this post


Link to post
Share on other sites
jonny41891

so it would be within the the main content/column with a header reading "Feature Posts" and display the feature post image only

Share this post


Link to post
Share on other sites
catrina

The hook you'll need to use is probably pagelines_content_before_maincolumn, so the add_action code you implement will look like this:

// add_action('hook_name','function name');
	add_action('pagelines_content_before_maincolumn', 'featured_posts');
	
	// function name
	function featured_posts(){

We're naming this function "featured_posts" so you know what the hook is for exactly. The next step would be to add the code that displays your 3 featured posts. Since you want it to look like Mashable's, you need to make sure that you have a featured image selected.


Please read the docs before posting. Please do not private message me unless I ask you to.

Designer | Catrina Dulay

Founder | Catrina and Mouse

Share this post


Link to post
Share on other sites
jonny41891

Aw yes, looks like we on the same track, I already put that part in the functions last night but I didn't do the excerpt part yet and doing it now.. So i guess the only thing thats left is the css, correct?

Share this post


Link to post
Share on other sites
catrina

Do you already have the code to input into the hook that displays the 3 posts?


Please read the docs before posting. Please do not private message me unless I ask you to.

Designer | Catrina Dulay

Founder | Catrina and Mouse

Share this post


Link to post
Share on other sites
jonny41891

I just have this

// add_action('hook_name','function name'); add_action('pagelines_content_before_maincolumn', 'featured_posts'); // function name function featured_posts(){
.. same exact one you posted

Share this post


Link to post
Share on other sites
jonny41891

Should put some divs around it?

Share this post


Link to post
Share on other sites
catrina

There is more to the code after the

function featured_posts(){

line. You'll need code that actually displays the 3 posts. The code I'm talking about looks something like this: ` <?php query_posts('category_name=wordpress&showposts=5'); ?> <?php while (have_posts()) : the_post(); ?>

<?php the_title(); ?> <?php endwhile; ?> ` The code above needs to be customized to have the content you want and then its style can be adjusted using CSS. What elements do you want in the featured post display (post title, post feature image, excerpt)?

Please read the docs before posting. Please do not private message me unless I ask you to.

Designer | Catrina Dulay

Founder | Catrina and Mouse

Share this post


Link to post
Share on other sites
jonny41891

For the main feature post I would like to have it big and to the left showing picure, title below, excerpt below title, how many comments(disqus), date and who submitted it.... for the 2 mini ones to the left, I would like to have just the picture, title and how many comments... For the 5 other feature posts below the two mini ones, I would just like to have the title.. This is probably confusing, what I would to get it to look like is here mashable.com, thanks again for your help

Share this post


Link to post
Share on other sites
catrina

Hm, I'm not sure how to go about with the formatting (with the mini posts and other posts below the mini ones), but I know what code to use to add the bits of information you want. The code would look something like this: ` <?php query_posts('category_name=featuredposts&showposts=3'); ?> <?php while (have_posts()) : the_post(); ?> <?php the_post_thumbnail(); ?>

<?php the_title(); ?> <?php $excerpt = get_the_excerpt( $deprecated ) ?>

<?php the_time('F jS Y') ?>

<?php the_author(); ?> <?php endwhile; ?> ` I'm not sure how to implement the link displaying how many Disqus comments there are, however, so I didn't include it. Also, there is no formatting for the code above yet (it's best to do the CSS last once the code is working).


Please read the docs before posting. Please do not private message me unless I ask you to.

Designer | Catrina Dulay

Founder | Catrina and Mouse

Share this post


Link to post
Share on other sites
jonny41891

I'm sorry if I threw you off with the disqus comments thing.. you just add the the regular comments code and disqus will just take over... So just add "<?php comments(); ?>" ?

Share this post


Link to post
Share on other sites
catrina

I'm not sure if that PHP for the comments will display the count for Disqus. I assumed the comments would need to be the default WordPress comments... but I could be wrong. You can try adding it and see if it works.


Please read the docs before posting. Please do not private message me unless I ask you to.

Designer | Catrina Dulay

Founder | Catrina and Mouse

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  

×