-
AuthorPosts
-
June 1, 2015 at 10:56 am #6858
Greg
GuestHi Ron,
Using Asteroid theme and am looking to add a thumbnail to the post entry header. Position will be before the header text. Similar to the avatar placement in the comments.
Is this done in the loop-blog.php? I’m struggling with the sample code. May I ask for your assistance?
Great theme, really enjoy working with it. Thanks for your help.
Greg
June 1, 2015 at 12:37 pm #6859Ron
KeymasterIs this done in the loop-blog.php?
It depends on when your thumbnail should appear. The loop-blog.php is used when showing the “posts page” (multiple posts) while the loop-single.php is used for single pages.
I’m struggling with the sample code.
What sample code?
On both loop-blog.php and loop-single.php the header text is added immediately after the opening
<article>
tag. You might want to add your image there.June 6, 2015 at 4:10 pm #6862Greg
GuestThank you for your reply, it made me realize I was taking the wrong approach and not asking the right question.
Ultimately, my goal is to have an icon image (in this case a favicon) align with and appear before the post title. Every time I create a new post I need the ability to drop the img src url (into a widget? custom field?) and have the icon spit out.
What is the best approach towards this functionally? I can’t discern the most optimal between custom widget or custom field. I’m definitely too novice.
Appreciate you taking my questions.
June 7, 2015 at 6:38 pm #6863Ron
KeymasterI’d like to point out that this functionality is not really specific to my themes and is more about modifying core WP functions. You may get better luck asking on forums like these:
https://wordpress.org/support/forum/themes-and-templates
https://wordpress.org/support/forum/plugins-and-hacksFor the “custom field” part, there’s already a plugin that could handle that:
https://wordpress.org/plugins/advanced-custom-fields/For joining the content of the custom field to the post title, you could use the title filter. This is just a sample/pseudo code to show how it could be done.
add_filter( 'the_title', 'ra_custom_post_title' ); function ra_custom_post_title( $title ) { $custom_field = get_post_meta($post_id, $key, $single); if ( ! empty($custom_field) ) { $title = $custom_field . $title; } return $title; }
Read more on https://codex.wordpress.org/Custom_Fields
June 11, 2015 at 4:08 am #6872Greg
GuestThank you Ron, helpful resources to get started with.
-
AuthorPosts
- The forum ‘Asteroid’ is closed to new topics and replies.