Community Forums › Forums › Archived Forums › Design Tips and Tricks › add link and icon to linkpost title in both single post and blog page
Tagged: blog page, entry-title, genesis_post_title_text, icon
- This topic has 9 replies, 2 voices, and was last updated 9 years, 4 months ago by
Brad Dalton.
-
AuthorPosts
-
October 27, 2016 at 1:44 pm #195399
sigul
MemberHi all,
I am trying to add linkpost to the new design for my blog (a la Gruber, post with title that links to another's blog article, "flagged" with an arrow at the end of the title).I found this function to add this to single post page (on sridharkatakam.com)
// Filter Post Title Text to wrap the title in a custom URL (if present)
add_filter( 'genesis_post_title_text', 'sk_post_title_text' );
function sk_post_title_text( $title ) {
if ( is_singular( 'post' ) ) {
$passthrough_url = esc_url( get_post_meta( get_the_ID(), 'passthrough_url', true ) );if ( $passthrough_url ) {
$title = ''.$title.' ➝';
}}
I am still wondering how to add the icon (just the icon, not the link) in the posts page (being it not home, not front, just the blog) posts title
http://37.60.241.80/~cristi43/diversoblog.com/November 3, 2016 at 5:29 pm #195691Brad Dalton
ParticipantI'm guessing you want to add a icon to the entry title on the page using the blog page template and link the icon to the single post?
November 5, 2016 at 3:57 am #195760sigul
Memberyes, actually I'd wanted to link title and icon, but your suggestion is very welcome. any idea about how to do that on the posts page? I suppose I need a template for this page, but I am not sure if it'll be working as wordpress posts page.
November 5, 2016 at 6:44 pm #195773Brad Dalton
ParticipantNovember 6, 2016 at 4:04 am #195780sigul
MemberSure.
This way, when you scroll down the blog's posts page, you know what is a post and what is a comment to others posts.
Thanks for helping
November 6, 2016 at 7:20 pm #195811Brad Dalton
ParticipantHappy to point you in the right direction. What you can try is add something like the following code to your filter function.
$icon = 'Path to your icon goes here'; return $icon . $title;
November 13, 2016 at 8:06 am #196100sigul
Memberhey Brad, thanks for helping, again. which filter are you thinking to use? this one: genesis_post_title_text or genesis_post_title_output?
something like that?
add_filter( 'genesis_post_title_text', 'custom_post_title' );
function custom_post_title() {
$icon = 'Path to your icon goes here';
return $icon . $title;
}November 13, 2016 at 10:00 am #196104Brad Dalton
ParticipantNovember 13, 2016 at 4:01 pm #196113sigul
Memberactually the function should check if the post of which it's getting the title has a $passthrough_url and if yes add a space and arrow (➝) to the $title.
if ($passthrough_url of the post of what you are getting the title ) {
$title = ''.$title.' ➝';
}but I am not sure of what code should be used to check that. do you know which?
November 13, 2016 at 10:24 pm #196118Brad Dalton
ParticipantI spent some time writing and testing this code which does what you want.
-
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.