WordPress.org

Ready to get started?Download WordPress

Forums

Not getting the 'Post Thumbnail' option after doing functions.php (11 posts)

  1. Bassius
    Member
    Posted 3 years ago #

    Hi,

    I'm making a custom theme in 3.1 and want to add thumbnails to my posts on the index. I've tried using the functions.php method, but once I've done that I do not get the option to add a thumbnail when editing or creating a post.

    Is this method outdated in 3.1 ? If so:

    - How do I add a thumbnail then?
    - How can I style the thumbnail element, if I do not need to call it in index.php anymore ?

    Thanks!

  2. prionkor
    Member
    Posted 3 years ago #

    What code you write on the functions.php? This is the code which should enable the post thumbnail feature when you placed it on functions.php file.

    add_theme_support('post-thumbnails');

  3. Bassius
    Member
    Posted 3 years ago #

    I've tried various options, but this in my current functions.php

    <?php
    if ( function_exists('register_sidebars') )
    register_sidebars(1);
    
    function kandidaat_init() {
      register_taxonomy(
        'kandidaat',
        'post',
        array(
          'label' => __('kandidaat'),
          'rewrite' => array('slug' => 'profiles'),
        )
      );
    }
    add_action( 'init', 'kandidaat_init' ); 
    
    add_theme_support( 'post-thumbnails' );
    set_post_thumbnail_size( 200, 200, true ); // Normal post thumbnails
    add_image_size( 'single-post-thumbnail', 400, 9999 ); // Permalink thumbnail size
    
    ?>

    What I'm using the functions.php for:

    - loading sidebar
    - create one or more taxonomies
    - load thumbnails

  4. alchymyth
    Forum Moderator
    Posted 3 years ago #

    http://wordpress.org/support/topic/troubleshooting-wordpress-31-master-list?replies=14

    have you tried the 'screen options' tab near the top right of the 'edit post' page?

  5. Bassius
    Member
    Posted 3 years ago #

    Yes, and it doesn't give me the option to enable thumbnails. What I can check there is:

    - Categories
    - Post
    - Tags
    - kandidaat (taxonomy)
    - Featured Image
    - WP Calendar Event
    - Excerpt
    - Send Trackbacks
    - Custom Fields
    - Discussion Comments
    - Slug
    - Author
    - Revisions

    Featured image is not the correct one if im right.

  6. Bassius
    Member
    Posted 3 years ago #

    Also I am using the 'Featured Content Gallery' plugin, but when deactivating that plugin I still do not get the option "Post Thumbnail".

  7. alchymyth
    Forum Moderator
    Posted 3 years ago #

    - Featured Image

    it is the correct one to tick
    - there is no difference between 'featured image' and thumbnail

    i don't know about that plugin.

  8. Bassius
    Member
    Posted 3 years ago #

    Thanks for that then :)

    Could you tell me how I can style the thumbnail element in CSS? Apparently I do not need to make a seperate PHP line in the index.php, which causes me to not have a seperate div for the thumbs.

  9. alchymyth
    Forum Moderator
    Posted 3 years ago #

    http://codex.wordpress.org/Function_Reference/the_post_thumbnail
    http://codex.wordpress.org/Function_Reference/the_post_thumbnail#Styling_Post_Thumbnails

    have a look into the html of your post/page in your browser, and locate the area with the thumbnail - there you should be able to see the css classes of the img tag.
    or use a tool such as firebug to check the thumbnail image css class.

  10. Bassius
    Member
    Posted 3 years ago #

    Hi,

    Thanks for that, but I already figured some of it out myself.

    Do you have any idea why WordPress assigns the #main img { } to a thumbnail ? I guess it is a bit of a mix between #main img and .thumb.

    I modified the PHP syntax and renamed the class for thumbnails to "thumb", but once I add a margin to that class it does not work. Borders however do work?

    Once I edit the #main img div and give that some margin, it works but I can't see where in the PHP a thumbnail should get that div ?

  11. alchymyth
    Forum Moderator
    Posted 3 years ago #

    this is one of the characteristics of css (Cascading Style Sheets):

    which means that the higher selectors also have an influence on the element - in this case on your img tag.

    it just means that your thumb image is an image img somewhere within an element with the css id #main

    the style for #main img might have a higher priority than a style for .thumb even if .thumb is a direct cssc lass of img

    any formats that are not set in the #main img style can be set by .thumb, but the ones defined alredy probably not.

    to work around this, try and use
    #main img.thumb { ... }
    to style your thumbnail image.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.