• I want to use a custom css and php file with my site. I used the following code and it fails on the php file and doesn’t seem to be formatted by the css

     *ACM Plugin activation.
     */
    require_once dirname( __FILE__ ) . '/plugins/xxxxxxx.php';
     *ACM style sheet.
     */
    function custom_style_sheet() {
    wp_enqueue_style( 'custom-styling', get_stylesheet_directory_uri() . '/xxxxxxx.css' );
    }
    add_action('wp_enqueue_scripts', 'custom_style_sheet');

    Help

Viewing 7 replies - 1 through 7 (of 7 total)
  • Here are some plugins that help you create working child themes:
    https://www.ads-software.com/plugins/search/child+theme/

    Here is some information about child themes https://codex.www.ads-software.com/Child_Themes

    Thread Starter sostroski57

    (@sostroski57)

    I was hoping for a non plugin solution, I have to do this for sites that use our POS software, I don’t want to add the plugin on their sites

    The plugins typically just help you create the child theme. You don’t need the plugin after it’s created, I think.

    Thread Starter sostroski57

    (@sostroski57)

    Hi have the child theme it was not problem. I just need to figure out how to reference a stylesheet and php file so far I haven’t had any luck. I can put in the the parent function.php but it will get lost if it gets updated.

    That’s what the original links I gave you are for…
    Your code looks like a plugin (comments). It goes in a particular place in a theme, on a particular action hook. That’s in the documentation.
    Also, you can look at child themes from the repository and see how they do things. Read the code. It’s there for you to read.

    Thread Starter sostroski57

    (@sostroski57)

    There is real stuff between the comments and I found the code from that site. I have in in the function.php fine in the child theme directory. The php seems to be working now but the stylesheet doesn’t

    require_once dirname( __FILE__ ) . ‘/plugins/myFile.php’;

    function custom_style_sheet() {
    wp_enqueue_style( ‘custom-styling’, get_stylesheet_directory_uri() . ‘/myStyle.css’ );
    }
    add_action(‘wp_enqueue_scripts’, ‘custom_style_sheet’);

    Thread Starter sostroski57

    (@sostroski57)

    I want to use myStyle.css in addition to the style.css from the parent.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘adding custom css & php to child theme’ is closed to new replies.