Okay
  Public Ticket #994828
Child theme not responsive
Closed

Comments

  •  3
    Kaushal started the conversation

    Hi,
    The child themes I am creating are not completely responsive in some sections for example portholes, headliner, slider and more. Please visit the site http://digispawn.com to see it for yourself. It looks very bad and it getting me some very bad comments and reviews from viewers. I was led to believe that explicit is 100% child theme compatible.

    No matter which plugin I use to create the child theme or If i create the child theme using wordpress codex instructions, the child theme still ends up being partly unresponsive as it is now.

    I had my hosting create a new wordpress installation in the site and I installed a fresh new download of the theme and tried creating a child theme and saw the same issue which means that it was not issue with corrupt theme files.

    I also copied the css folder including the responsive.css and other css files in the child theme and enqueued them in but still no solution. Kindly help me solve this issue asap because i need to go officially live very soon.

    Below is the code for my child theme's functions.php 

    <?php
    add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );
    function my_theme_enqueue_styles() {
        wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
        wp_enqueue_style( 'parent-style', get_stylesheet_directory_uri() . '/css/responsive.css' );
        wp_enqueue_style( 'parent-style', get_stylesheet_directory_uri() . '/css/bootstrap.css' );
    }

    ?>

    Attached files:  childtheme2.PNG
      childtheme1.PNG
      childtheme3.PNG
      childtheme4.PNG

  •  241
    Brian replied

    The responsive stylesheet should be the very last thing enqueued. It should go bootstrap, then style, then responsive.

  •  3
    Kaushal replied

    Well that completely broke the site. I removed that version of child theme and created a new child theme using Orbisius child theme creator. The code in the functions.php is now as below. 


    function orbisius_ctc_explicit_child_theme_enqueue_styles() {
        $parent_style = 'orbisius_ctc_explicit_parent_style';
        $parent_base_dir = 'explicit';

        wp_enqueue_style( $parent_style,
            get_template_directory_uri() . '/style.css',
            array(),
            wp_get_theme( $parent_base_dir ) ? wp_get_theme( $parent_base_dir )->get('Version') : ''
        );

        wp_enqueue_style( $parent_style . '_child_style',
            get_stylesheet_directory_uri() . '/style.css',
            array( $parent_style ),
            wp_get_theme()->get('Version')
        );
    }

    add_action( 'wp_enqueue_scripts', 'orbisius_ctc_explicit_child_theme_enqueue_styles' );

  •  241
    Brian replied

    What do you mean by broke the site? Do you mean a PHP error, or the CSS/layout was off?

  •  3
    Kaushal replied

    The CSS/Layout was off. I have anyhow deleted that child theme and created a new one using Orbisius child theme creator. This child theme too has the same issues with responsivity as i mentioned earlier. I have shared the code to its functions.php file in my last reply. For the purpose of troubleshooting do you recommend continuing with this child theme ( created with orbisius) or should i create a new child theme made with wordpress codex?

  •  241
    Brian replied

    I've never used Orbisius so I'm not sure how that works. I definitely recommend going the WordPress codex route.

  •  3
    Kaushal replied

    Ok. I deleted the child theme created with Orbisius and created a new one using wordpress codex as reference. Code for style.css and functions.php is below. The site still suffers from incomplete responsiveness for various sections. You can visit the site at digispawn.com to see for yourself.

    Style.css

    /*
    Theme Name: Explicit Child NEW
    Theme URI: http://www.industrialthemes.com/explicit
    Template: explicit
    Author: Industrial Themes
    Author URI: http://www.industrialthemes.com
    Description: Explicit is a full-fledged magazine theme that offers such ammenities as a review system, awards and badges, AJAX sorting and filtering, category icons and colors, post reactions, and more.
    Tags: left-sidebar,right-sidebar,custom-header,custom-background,theme-options,threaded-comments,fixed-layout,responsive-layout,two-columns,translation-ready,custom-menu
    Version: 2.4.1461771137
    Updated: 2016-04-27 15:32:17

    */

    function.php

    <?php

    add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );
    function my_theme_enqueue_styles() {
        wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );

    }
    ?>

  •  241
    Brian replied

    I'm not sure why this would be happening. Do you want to try another one of our themes instead to see if it works using the same technique?

  •  3
    Kaushal replied

    I tested the same on the steam theme. Same results.

  •  3
    Kaushal replied

    I discussed this with my hosting provider, bluehost who think this could be because of mismatched php settings between your the theme and the hosting. They have asked to you check my php settings and see if there is anything out of place or incompatible which we can then correct. Also where are theme's php settings? PHP Setting for the site: http://digispawn.com/info.php

  •  241
    Brian replied

    I don't understand what you mean by the "theme's php settings". PHP settings are set on your server, and WordPress has a .htaccess file where it sets site-specific settings. But the theme does not do that.

  •  3
    Kaushal replied

    Hi Brian, I have tried with a different theme but I get the same issue of child theme not being responsive. I talked to the hosting provider and they say that the issue is not at their end.

  •  3
    Kaushal replied

    I solved the issue myself. The child theme was not reading the responsive.css file so i dequeued the parent theme responsive.css from the functions.php. Created new css folder in the child theme folder and added the 3 css files in there namely: responsive.css, bootstrap.css and editor-style.css. After that i just enqueued these 3 files in the child theme functions.php folder. The code for the function.php file is as below:


    <?php

    show_admin_bar(false);

    function my_theme_enqueue_styles() {

        $parent_style = 'parent-style'; // This is 'twentyfifteen-style' for the Twenty Fifteen theme.

        wp_enqueue_style( $parent_style, get_template_directory_uri() . '/style.css' );

       wp_dequeue_style( 'responsive.css' );
       wp_enqueue_style( 'explicit_child_new', get_stylesheet_directory_uri() . '/css/responsive.css' );

       wp_dequeue_style( 'bootstrap.css' );
       wp_enqueue_style( 'explicit_child_new', get_stylesheet_directory_uri() . '/css/bootstrap.css' );

       wp_dequeue_style( 'editor-style.css' );
       wp_enqueue_style( 'explicit_child_new', get_stylesheet_directory_uri() . '/css/editor-style.css' );

        wp_enqueue_style( 'child-style',
            get_stylesheet_directory_uri() . '/style.css',
            array( $parent_style ),
            wp_get_theme()->get('Version')
        );
    }
    add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles', 11 );

    ?>

  •  241
    Brian replied

    Glad you got it working, and thanks for sharing your solution!