Streamline Theme – Questions on "featured image"

Community Forums Forums General Discussion Streamline Theme – Questions on "featured image"

This topic is: not resolved

This topic contains 15 replies, has 2 voices, and was last updated by  ludvig 1 year ago.

Viewing 15 posts - 1 through 15 (of 16 total)
  • Author
    Posts
  • #57060

    ludvig
    Participant
    Post count: 75

    Hey,

    I was wondering whether the “featured image”, that originally comes with the theme and is placed above posts, can be customized to show on specific posts rather than on ALL posts or NO posts.

    Currently I have disabled it due to it giving me trouble with my old posts; giving rise to duplicate pictures and adding to that that my old blog posts pictures are in terrible resolution and do not look good in the format of the featured image.
    (There is an option to disable the duplicate pictures in the theme options, but I have crossed that box and it is still giving me issues on a few posts)

    Now I think the “featured image” of Streamline looks great, but only when done correctly. It looks awful on my old posts. What I would like to do is to disable it for all old posts, but add it to my new posts and select images that look nice in that format.

    So, is this possible to do; can I adjust for the “featured image” function above the posts to be customized per post?

    http://www.startgainingmomentum.com
    #57061

    braddalton
    Participant
    Post count: 9446

    Yes you can add conditional tags with an array of page/post i.d’s after the function to the PHP code in your child themes functions.php file.

    Or change the conditional in this code in your functions file.

    Or you can use CSS code:
    [css]
    .home .post-image {
    display: none;
    }
    [/css]

    View the source code to find the post/page i.d in the body class.

    Nite these code snippets are samples and would need to be customized to your needs.


    Specializing In StudioPress Child Theme Customization.
    500+ StudioPress Tutorials

    #57063

    ludvig
    Participant
    Post count: 75

    Wow, thanks a lot for the quick answer Brad!

    I’ll post again if I get a problem.

    #57613

    ludvig
    Participant
    Post count: 75

    Hey again,

    I’ve been trying to get it working, but I’m having some trouble. I’ve only been toying with CSS & PHP files for two weeks and barely understand how to structure it.

    Question:

    1.Do I need to collect every PageID and insert manually into the code? (Because none of my old posts fit the format for the featured above picture and would therefore not look well with it)

    2. Once having collected these PageIDs (not the hard part), WHERE and HOW do I put them into the PHP, could you post an example? When I say how, what I’m really asking is how to separate the IDs and how to “finish” the code.
    Would it be like this?

    /** Add post image above post title */
    add_action( ‘genesis_before_post’, ‘streamline_post_image’ );
    function streamline_post_image() {

    if ( pageID1, pageID2, PageID3, etc…() ) return;

    if ( $image = genesis_get_image( ‘format=url&size=post-image’ ) ) {
    printf( ‘‘, get_permalink(), $image, the_title_attribute( ‘echo=0′ ) );
    }

    }

    #57623

    braddalton
    Participant
    Post count: 9446

    You add an array:

    Or you can tag them and add the conditional tag [php]if ( has_tag( ‘brads-tag’ ) ) return;[/php]


    Specializing In StudioPress Child Theme Customization.
    500+ StudioPress Tutorials

    #57644

    ludvig
    Participant
    Post count: 75

    The issue has now been resolved, though it took some time to manually look up and write all the IDs.

    I want to note for future readers that in my case it had to be is single not is page, because all of my old blog posts that look horrible with the Streamline featured image function were single posts.

    Thanks a lot Brad,
    I will likely post a few more questions in the coming days and weeks seeing as how I have so much to learn and so much to do until I am content with the appearance of my blog. I hope they too will be answered as quickly and skillfully!
    :)

    #57659

    ludvig
    Participant
    Post count: 75

    Actually I was wrong, the issue is not entirely resolved.

    I only fixed it INSIDE the posts by doing that. So now I got 50 % of the problem solved.

    http://www.startgainingmomentum.com/

    If you take a look at my blog you’ll note that on the home/front page it looks bad with the featured pictures. But inside the posts it looks as it should.

    I already got the correct array and combinations of IDs, I just need to understand which code to use so that I can remove the same combination of featured images from my front page.

    I’ve tried a bunch of different variations, including is_home and is_front_page but I am coming up short for the moment.

    Any thoughts of what I can do?

    • This reply was modified 1 year ago by  ludvig.
    • This reply was modified 1 year ago by  ludvig.
    #57720

    braddalton
    Participant
    Post count: 9446

    Use CSS code instead.
    [css]
    .home .post-image {
    display: none;
    }
    [/css]


    Specializing In StudioPress Child Theme Customization.
    500+ StudioPress Tutorials

    #57922

    ludvig
    Participant
    Post count: 75

    I’ve been trying to use the CSS code (and checked out your post on it on your blog) and yeah it works, but it effectively eliminates ALL the featured images in the posts shown on my home page/ blog template.

    And I do not want to completely eliminate it, I only want it to be hidden from the “ugly”, old images, that I have in my previous blog posts. I want to keep the featured pictures showing in the home page/blog template for all the new posts I make.

    Thus far I have been able to eliminate the featured images inside the posts by using the “.single (array( post id)” command that you showed me.

    But those ugly featured images are still showing on the home page/blog template.

    Is there no way to customize it on the home page/blog template in the exact same manner that I’ve been able to do with the posts?

    Perhaps I am misunderstanding this, I am very new to PHP/CSS.

    • This reply was modified 1 year ago by  ludvig.
    • This reply was modified 1 year ago by  ludvig.
    #58033

    braddalton
    Participant
    Post count: 9446

    You can use the remove action in a custom function:

    You will need to change the conditional tag.


    Specializing In StudioPress Child Theme Customization.
    500+ StudioPress Tutorials

    #58253

    ludvig
    Participant
    Post count: 75

    Thanks for being persistent in helping me Brad, but I am a hardcase at this stuff :)

    I am having trouble understanding how I am supposed to change the conditional tags appropriately.. I managed to do it the last time but this is proving a bit difficult.

    Here is how the code looks for my previous PHP that was successful in removing the featured image from inside the posts:

    /** Add post image above post title */
    add_action( ‘genesis_before_post’, ‘streamline_post_image’ );
    function streamline_post_image() {

    if ( is_single( array( 140, 145, 154, 91, 160, 161, 162, 173, 180, 206, 194, 213, 239, 291, 312, 323, 333, 382, 424, 493, 516, 562, 622, 659, 684, 717, 752, 791, 750, 816, 847, 862, 884, 889, 950, 969, 1030, 1015, 1057, 1086, 1105, 1159, 1185, 1228, 1246, 1257, 1263, 1295 ) ) ) return;
    if ( is_page ( 28 ) ) return;

    if ( $image = genesis_get_image( ‘format=url&size=post-image’ ) ) {
    printf( ‘%s‘, get_permalink(), $image, the_title_attribute( ‘echo=0′ ) );
    }

    }

    How would I go about adjusting the new code you suggested?
    Here is how I have written it right now just under the section above , but it is obviously completely wrong as it crashes my page:

    add_action(‘genesis_post_content’, ‘remove_featured_image_single‘);
    function remove_featured_image_single() {
    if(is_single( 140, 145, 154, 91, 160, 161, 162, 173, 180, 206, 194, 213, 239, 291, 312, 323, 333, 382, 424, 493, 516, 562, 622, 659, 684, 717, 752, 791, 750, 816, 847, 862, 884, 889, 950, 969, 1030, 1015, 1057, 1086, 1105, 1159, 1185, 1228, 1246, 1257, 1263, 1295 ) ) {
    remove_action( ‘genesis_post_content’, ‘genesis_do_post_image’ );

    }

    }

    I basically just replaced where you had category to what had worked in the code above for me seeing as how there are many posts that need to be adjusted and the issue is non-category specific,. But it didn’t work. I am messing up the code because I don’t really understand how to write it properly yet.

    • This reply was modified 1 year ago by  ludvig.
    • This reply was modified 1 year ago by  ludvig.
    #58256

    ludvig
    Participant
    Post count: 75

    It no longer crashes my page when I changed it to:

    add_action(‘genesis_post_content’, ‘remove_featured_image_specific_category’);
    function remove_featured_image_specific_category() {
    if( is_single( array( 140, 145, 154, 91, 160, 161, 162, 173, 180, 206, 194, 213, 239, 291, 312, 323, 333, 382, 424, 493, 516, 562, 622, 659, 684, 717, 752, 791, 750, 816, 847, 862, 884, 889, 950, 969, 1030, 1015, 1057, 1086, 1105, 1159, 1185, 1228, 1246, 1257, 1263, 1295 ) ) ) {
    remove_action( ‘genesis_post_content’, ‘genesis_do_post_image’ );

    }

    }

    But it produces no effect

    #58281

    braddalton
    Participant
    Post count: 9446

    I don’t think this hook will work on the home page, only on posts.
    [php]
    genesis_post_content
    [/php]


    Specializing In StudioPress Child Theme Customization.
    500+ StudioPress Tutorials

    #58475

    ludvig
    Participant
    Post count: 75

    Hm.. Ok.

    Damn, I can’t believe no one else has had to before to solve this problem. I’ve been searching a lot for how other people have solved this, but I can’t find anyone.

    All posts I find are only about hiding posts using categories.

    I’ll keep searching and update if I find something.

    In the meantime I will inactivate the feature picture command.

    #58510

    braddalton
    Participant
    Post count: 9446

    Most people use CSS however i believe its simply a matter of changing the hook. I will work this out when i have time.


    Specializing In StudioPress Child Theme Customization.
    500+ StudioPress Tutorials

Viewing 15 posts - 1 through 15 (of 16 total)

You must be logged in to reply to this topic.