WordPress.org

Ready to get started?Download WordPress

Forums

Oxygen
disable featuring images that are attached to posts (17 posts)

  1. electrolund
    Member
    Posted 2 years ago #

    LOVE your theme. It's great.

    I'm having an issue where on archive home pages, posts with attached images, but no featured image set, are getting one of the attached images set as a featured image for the archive listing. Here's an example:

    http://www.electrolund.com/category/movies/comparisons/

    Is there a way to make the featured image area above the post truly only a featured image (require the post to have the featured set)?

    http://wordpress.org/extend/themes/oxygen/

  2. Griden
    Member
    Theme Author

    Posted 2 years ago #

    Yes, I'm aware of this + I agree it should allow for more control and it would be improved in the next update.

  3. electrolund
    Member
    Posted 2 years ago #

    Griden, I have a satisfactory fix I'm using as a child theme. Here is the code to line 42 of index.php:

    <?php if ( has_post_thumbnail() ) { // check if the post has a Post Thumbnail assigned to it.
      the_post_thumbnail(array(470,140));
    } else { ?>
      <img src="<?php bloginfo('template_directory'); ?>/images/archive-thumbnail-placeholder.gif" alt="<?php the_title(); ?>" />
    <?php } ?>

    Example of it running: http://www.electrolund.com/

  4. Macnanimos
    Member
    Posted 2 years ago #

    Excuse me electrolund, but i don't know how to paste your code at line 42, can you help me?

  5. electrolund
    Member
    Posted 2 years ago #

    Sure, Macnanimos. First, are you using this same theme, Oxygen? Are you then using a child theme in order to make these kinds of customizations?

    If not, then here's what you do:

    1) Go to your web host's /wp-content/themes/ folder and create a new folder in there called "oxygen-child". Oxygen supports child themes, which is a brilliant way to make changes without losing them when your parent theme gets an upgrade released.

    2) Copy the index.php file from the parent Oxygen theme folder and paste it into this newly created oxygen-child folder.

    3) Now go to line 42 of this copied index.php. Delete the original code at 42, which looked like this:

    <?php if ( current_theme_supports( 'get-the-image' ) ) {
    
      get_the_image( array( 'meta_key' => 'Thumbnail', 'size' => 'archive-thumbnail', 'image_class' => 'featured', 'width' => 470, 'height' => 140, 'default_image' => get_template_directory_uri() . '/images/archive-thumbnail-placeholder.gif' ) );							
    
    } ?>

    4) Insert my code in that spot.

    More questions?

  6. eglass
    Member
    Posted 2 years ago #

    loving the theme too! slightly related question:

    is it possible to not have featured images show up in the actual post? i can't seem to make that happen. i don't want the featured image to show up in the post because i'm placing a youtube video there instead.

    example:
    http://nml.cuny.edu/sciencestudies/?p=965

    thanks!

  7. electrolund
    Member
    Posted 2 years ago #

    eglass, have a look in Oxygen's template file page.php, line 44. Looks like this:

    <?php if ( current_theme_supports( 'get-the-image' ) ) get_the_image( array( 'meta_key' => 'Thumbnail', 'size' => 'single-thumbnail', 'link_to_post' => false, 'image_class' => 'featured', 'attachment' => false, 'width' => 470, 'height' => 260 ) ); ?>

    If you are using a child theme to make protected changes to the theme, then just omit this line in your page.php inside "oxygen-child" folder

  8. eglass
    Member
    Posted 2 years ago #

    electrolund,

    thanks much for your response. i've been trying to teach myself how to make a child theme, but for some reason when activated, it loses all of the parent's formatting.

    i've put the child theme in the wp-content folder with a style.css sheet that looks like this:

    /*
    Theme Name:     Oxygen Child
    Description:    Child theme for the Oxygen theme
    Author:         Erin Glass
    Template:       oxygen-1
    Version:        0.1.0
    */
    
    @import url ("../oxygen-1/style.css"); 
    
    }

    my template and theme are both "oxygen-1" instead of "oxygen" as for some reason the theme template was originally imported with that name and i'm not sure how to change it back without screwing up the site. i don't think that's why the child theme isn't working.

    any idea what might be going wrong with the child theme? thanks again.

  9. electrolund
    Member
    Posted 2 years ago #

    Hey, eglass. A great place to start is the WP Codex entry on child themes.

    So your naming convention is fine (although it's typical to use something like "-child" after the parent name just to keep things straight, but whatever). But the Template line in your header comment box needs to reference the parent theme name exactly. Refer to step 5 under "Example of a basic Child Theme"

    Template: declares the child theme’s parent; i.e., the directory of the theme whose templates the child uses.

    Now it should be loading your parent theme and then importing your new stylesheet changes.

  10. eglass
    Member
    Posted 2 years ago #

    Hi electrolund,

    Ok, I fixed my theme so that it's only "oxygen," and not "oxygen-1." My installed child theme is now oxygen-child, and the style.css file looks like this:

    /*
    Theme Name:     Oxygen Child
    Description:    Child theme for the Oxygen theme
    Author:         Erin Glass
    Template:       oxygen
    Version:        0.1.0
    */
    
    @import url ("../oxygen/style.css"); 
    
    }

    The child theme successfully uploads and activates, but the formatting is still all mush. Am I completely missing your advice? As far as I can tell, I'm following the WP Codex.

  11. electrolund
    Member
    Posted 2 years ago #

    Can you tell me what exactly is happening? What does "all mush" mean?

    Typically, when I'm working with child themes, I try to go in steps. So the first thing I will do is (like you have done) create the child theme folder, and a stripped out child stylesheet that only imports the parent stylesheet.

    Then test that first to see if the styles are truly importing. If you suspect they aren't, have a look at the generated HTML and see if there's a stylsheet file referenced there.

    After that's all working, then work with the modified template PHP files.

  12. electrolund
    Member
    Posted 2 years ago #

    Quick thought. All the examples of @import that I'm reading don't include a space after url. Try removing that between url and ("../oxygen/style.css");

  13. eglass
    Member
    Posted 2 years ago #

    holy toledo, that worked! thank you so much! child theme is now working and i've successfully gotten the featured images to not show up on the posts.

    i've been having newcomer wordpress issues for weeks so it's been rad to find out how supportive and generous the web community can be. thanks again and best to you!

  14. electrolund
    Member
    Posted 2 years ago #

    Oh sweet, nice work!

    I'm glad to give back to the community, as I've taken a bunch from it, so all good.

  15. danimariesc
    Member
    Posted 1 year ago #

    eglass- does this mean you're now able to choose whether or not a post will have a featured image (that's what I'd like to be able to do) or do you just not have any featured images at all? Thanks

  16. Aldouslzl
    Member
    Posted 1 year ago #

    Hi Electrolund

    Do you know how to remove the 'recent comments' & the 'more comments' section of the oxygen theme? I'm having trouble removing it, and try a few forum but it doesn't work.

    Please advise,

  17. Mark
    Member
    Posted 1 year ago #

    Aldouslzl, please start your own thread instead of reviving an existing one on an unrelated topic.

    In general, what you would do is (1) create a child theme, (2) locate the template file that generates whatever you are trying to remove, (3) place a copy of that template file in your child theme, and (4) edit that template file so that it doesn't generate whatever you don't want it to generate.

    If you mean "articles" instead of comments, here are some directions you can follow.

Topic Closed

This topic has been closed to new replies.

About this Theme

About this Topic