Where exactly do I add the .php code:

Hi there,

I am trying to format my Q&A so it will display in my Child Theme; the page is here:


as you can see it is illegible and needs styling.

I understand I need to add this code: <?php add_theme_support(‘qa_style’:wink:; ?>

into my functions.php file of my Theme…..is that correct?

Can you tell me where EXACTLY in that functions.php file I add the code??

thanks so much!!

  • elucia
    • WPMU DEV Initiate

    OK; omg well I’m a total dummy.

    I pasted the code exactly as above, and it broke my site. The error message I get is:

    Parse error: syntax error, unexpected ‘<‘ in /home/elucia/public_html/blog/wp-content/themes/BuilderChild-Scooter/functions.php on line 82

    so, I remove the ” ?>” and I also tried removing just the “>” and still not working; I get the same error code and site goes poof.

    I’ve pasted the original functions.php code back in and the site is back to normal.

    The code at the very end of my functions.php file (before I try pasting in the above code) looks like this:


    $sizes = array( $_ithemes_temp_downsize_size => $sizes[$_ithemes_temp_downsize_size] ); // Strip out all extra meta data so only the requested size will be generated.

    return $sizes;




    Where/how would I paste the code I need so I don’t break the site?

    thanks so much for your patience!

  • elucia
    • WPMU DEV Initiate

    yes, thank you! here it is:


    // Adding Theme Support for Post Thumbnails
    if ( function_exists( 'add_theme_support' ) ) {
    add_theme_support( 'post-thumbnails' );
    set_post_thumbnail_size( 150, 150 ); // default Post Thumbnail dimensions

    // Creating Custom Thumbnail Sizes
    if ( function_exists( 'add_image_size' ) ) {
    add_image_size( 'magazine-thumb', 100, 100, true ); //300 pixels wide (and unlimited height)

    // Loading '/lib' Files
    require_once('lib/outer-wrapper.php'); // Moves the classes from the inner wrapper to the outer wrapper
    require_once('lib/alternate-modules.php'); // Adds alternate module styles

    // Custom image resize function by iThemes.com. iTeration 19
    if ( !function_exists( 'ithemes_filter_image_downsize' ) ) {
    add_filter( 'image_downsize', 'ithemes_filter_image_downsize', 10, 3 ); // Latch in when a custom image size is called.
    add_filter( 'intermediate_image_sizes_advanced', 'ithemes_filter_image_downsize_blockextra', 10, 3 ); // Custom image size blocker to block generation of thumbs for sizes other sizes except when called.
    function ithemes_filter_image_downsize( $result, $id, $size ) {
    global $_ithemes_temp_downsize_size;
    if ( is_array( $size ) ) { // Dont bother with non-named sizes. Let them proceed normally. We need to set something to block the blocker though.
    $_ithemes_temp_downsize_size = 'array_size';

    // Store current meta information and size data.
    global $_ithemes_temp_downsize_meta;
    $_ithemes_temp_downsize_size = $size;
    $_ithemes_temp_downsize_meta = wp_get_attachment_metadata( $id );

    if ( !is_array( $imagedata = wp_get_attachment_metadata( $id ) ) ) { return $result; }
    if ( !is_array( $size ) && !empty( $imagedata['sizes'][$size] ) ) {
    $data = $imagedata['sizes'][$size];
    // Some handling if the size defined for this size name has changed.
    global $_wp_additional_image_sizes;
    if ( empty( $_wp_additional_image_sizes[$size] ) ) { // Not a custom size so return data as is.
    $img_url = wp_get_attachment_url( $id );
    $img_url = path_join( dirname( $img_url ), $data['file'] );
    return array( $img_url, $data['width'], $data['height'], true );
    } else { // Custom size so only return if current image file dimensions match the defined ones.
    global $_wp_additional_image_sizes;
    if ( ( $_wp_additional_image_sizes[$size]['width'] == $data['width'] ) && ( $_wp_additional_image_sizes[$size]['height'] == $data['height'] ) ) { // Only return if size hasnt changed.
    $img_url = wp_get_attachment_url( $id );
    $img_url = path_join( dirname( $img_url ), $data['file'] );
    return array( $img_url, $data['width'], $data['height'], true );

    require_once( ABSPATH . '/wp-admin/includes/image.php' );
    $uploads = wp_upload_dir();
    if ( !is_array( $uploads ) || ( false !== $uploads['error'] ) ) { return $result; }
    $file_path = "{$uploads['basedir']}/{$imagedata['file']}";

    // Image is resized within the function in the following line.
    $temp_meta_information = wp_generate_attachment_metadata( $id, $file_path ); // triggers filter_image_downsize_blockextra() function via filter within. generate images. returns new meta data for image (only includes the just-generated image size).

    $meta_information = $_ithemes_temp_downsize_meta; // Get the old original meta information.

    if ( array_key_exists( 'sizes', $temp_meta_information ) ) {
    $meta_information['sizes'][$_ithemes_temp_downsize_size] = $temp_meta_information['sizes'][$_ithemes_temp_downsize_size]; // Merge old meta back in.
    wp_update_attachment_metadata( $id, $meta_information ); // Update image meta data.

    unset( $_ithemes_temp_downsize_size ); // Cleanup.
    unset( $_ithemes_temp_downsize_meta );

    return $result;
    /* Prevents image resizer from resizing ALL images; just the currently requested size. */
    function ithemes_filter_image_downsize_blockextra( $sizes ) {
    global $_ithemes_temp_downsize_size;
    if ( empty( $_ithemes_temp_downsize_size ) || ( $_ithemes_temp_downsize_size == 'array_size' ) ) { // Dont bother with non-named sizes. Let them proceed normally.
    return $sizes;
    $sizes = array( $_ithemes_temp_downsize_size => $sizes[$_ithemes_temp_downsize_size] ); // Strip out all extra meta data so only the requested size will be generated.
    return $sizes;


  • James Farmer
    • CEO (of WPMU DEV, honest)

    Hi Elucia,

    As we haven’t heard back from you we’re going to assume the problem was sorted out and mark this thread as resolved.

    If it wasn’t resolved, or you have any more questions related to this thread please feel free to post them below and tick the ‘Mark as Not Resolved (re-open)’ box below the post area (or else we’ll miss it!)

    Otherwise, thanks for using the forums, and, as always, for being a member of WPMU DEV, it’s a pleasure to help you out and we look forward to being of assistance in the future.

    Cheers, James

  • elucia
    • WPMU DEV Initiate

    Hi James

    thank you for following up.

    No, it didn’t work, and I had spent so much time on it that I had to stop and move on to other things. I never was able to use the Q and A plugin…I just gave up.

    If I remember correctly, for ME the plugin is difficult to style…integrating it into my site is the goal, and I can’t see having to spend so much time on coding php to get a plugin to look, as well as function, as I need. That’s why I BUY plugins. It would be great if the plugin had built-in styling features that do not require php coding.


    I really DO want to use it so maybe I will give it another try with the plugin upgrade.

    thank you for the follow up.


Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.