WordPress.org

Support

Support » Themes and Templates » Oxygen » [Theme: Oxygen] disable featuring images that are attached to posts

[Theme: Oxygen] disable featuring images that are attached to posts

Viewing 15 replies - 1 through 15 (of 16 total)
  • Theme Author Griden

    @griden

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

    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/

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

    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?

    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!

    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

    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.

    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.

    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.

    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.

    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");

    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!

    Oh sweet, nice work!

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

    danimariesc

    @danimariesc

    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

    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,

Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘[Theme: Oxygen] disable featuring images that are attached to posts’ is closed to new replies.
Skip to toolbar