Community Forums › Forums › Archived Forums › Design Tips and Tricks › Show Category BEFORE Post
Tagged: categories, magazine, show category
- This topic has 14 replies, 3 voices, and was last updated 12 years, 1 month ago by
delectablychic.
-
AuthorPosts
-
March 4, 2013 at 9:07 pm #24261
delectablychic
MemberIs there a way to show the primary/parent category of a post ABOVE the actual post (either above the headline/title or just below it) rather or in addition to the "filed under" section at the bottom? I'd like this to show both on the homepage and in individual posts similar to a site like http://www.theluxelife.com.
DelectablyChic!, an online lifestyle publication with a focus on style, dining, travel and more.
March 4, 2013 at 10:52 pm #24267Brad Dalton
ParticipantYou can insert a shortcode for the post meta using Genesis Simple Edits
March 5, 2013 at 7:33 am #24284delectablychic
MemberBraddalton: Simple Edits doesn't move the category link though. Also, when I tried it, I ended up with an apostrophe before the category.
DelectablyChic!, an online lifestyle publication with a focus on style, dining, travel and more.
March 5, 2013 at 9:33 am #24301surefirewebserv
MemberHere you go
/** Remove the post meta function */
remove_action( 'genesis_after_post_content', 'genesis_post_meta' );
add_action('genesis_before_post_title','genesis_post_meta')'Then if you want to edit it:
/** Customize the post meta function */
add_filter( 'genesis_post_meta', 'post_meta_filter' );
function post_meta_filter($post_meta) {
if ( !is_page() ) {
$post_meta = '[post_categories before="Filed Under: "] [post_tags before="Tagged: "]';
return $post_meta;
}}
SureFireWebServices.com | Genesis Tuts and More
Genesis Theme Starter Kit | It’s FreeMarch 5, 2013 at 12:05 pm #24339delectablychic
MemberSurefirebserv: Will this work for the homepage?
DelectablyChic!, an online lifestyle publication with a focus on style, dining, travel and more.
March 5, 2013 at 1:13 pm #24356surefirewebserv
MemberYes, you'll just have to add the conditional is_home() to the action hooks.
SureFireWebServices.com | Genesis Tuts and More
Genesis Theme Starter Kit | It’s FreeMarch 5, 2013 at 1:57 pm #24368delectablychic
MemberHi surefireweserv:
If I were to use Genesis Simple Hooks, where would I post it? Or does this go on the CSS?
Thanks
DelectablyChic!, an online lifestyle publication with a focus on style, dining, travel and more.
March 5, 2013 at 3:08 pm #24398surefirewebserv
MemberHere you go:
add_action('genesis_before_loop','sfws_move_category');
/**
* Move Categories above title.
*
* @author Sure Fire Web Services
* @link http://surefirewebservices.com/?p=1563
*
*/
function sfws_move_category() {
if ( ! is_home() || ! is_front_page() )
return;
remove_action( 'genesis_after_post_content', 'genesis_post_meta' );
add_action('genesis_before_post_title','genesis_post_meta');
}That's just for the homepage. If you want it site wide, just remove the if statement. Simple Hooks may be a bit confusing if you're not sure what you're doing.
Add the code in your functions.php file. Nothing in CSS.
SureFireWebServices.com | Genesis Tuts and More
Genesis Theme Starter Kit | It’s FreeMarch 5, 2013 at 3:15 pm #24401delectablychic
Membersurefirewebserv: It doesn't look like it's working?
My test site is http://testsite.delectablychic.com
DelectablyChic!, an online lifestyle publication with a focus on style, dining, travel and more.
March 5, 2013 at 3:25 pm #24408surefirewebserv
MemberWorked on mine.. What widget are you using to display the posts?
Also, you can try to remove the if statement.
if ( ! is_home() || ! is_front_page() )
return;
SureFireWebServices.com | Genesis Tuts and More
Genesis Theme Starter Kit | It’s FreeMarch 5, 2013 at 4:05 pm #24422delectablychic
MemberHi surefirewebserv,
I'm using Feature Widget Amplified. Should I be switching back to the standard one?
Thanks
DelectablyChic!, an online lifestyle publication with a focus on style, dining, travel and more.
March 5, 2013 at 8:56 pm #24477delectablychic
MemberOne more thing: Is it supposed to go in a particular spot in the functions.php file or anywhere at all?
Thanks
DelectablyChic!, an online lifestyle publication with a focus on style, dining, travel and more.
March 6, 2013 at 9:40 am #24548surefirewebserv
MemberAnywhere in functions.php. Featured Widget Amplified uses different hooks and it's a bit more difficult. If you can use the standard one.
I'm not 100% familiar with the widgets hooks.
SureFireWebServices.com | Genesis Tuts and More
Genesis Theme Starter Kit | It’s FreeMarch 6, 2013 at 12:47 pm #24577delectablychic
MemberAnother thing: Do I use both codes you gave me (post #24301 and post #24398)? I think I tried using both only to get a white screen of death?
Thanks
Cynthia
DelectablyChic!, an online lifestyle publication with a focus on style, dining, travel and more.
March 6, 2013 at 9:19 pm #24721delectablychic
MemberOh, and by the way: I might be switching from Lifestyle to Metro soon, so would using Simple Hooks be better? I just need to know where to put the code.
Thanks
DelectablyChic!, an online lifestyle publication with a focus on style, dining, travel and more.
-
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.