• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

Authority Pro: custom css for custom template

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › Design Tips and Tricks › Authority Pro: custom css for custom template

This topic is: resolved

Tagged: custom template

  • This topic has 5 replies, 2 voices, and was last updated 4 years, 4 months ago by Detlef.
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • July 22, 2019 at 8:54 am #492469
    Detlef
    Participant

    Hi,
    i’m using Authority Pro and want to have custom css for custom templates. The custom template I created 'meineseite.php' is fetched (stored in folder /page-templates). The css 'meineseite.css' is uploaded to the same folder.

    Added following code to function.php

    // custom css für templates
    function wpse_enqueue_page_template_styles() {
    if ( is_page_template( 'meineseite.php' ) ) {
    wp_enqueue_style( 'meineseite', get_template_directory_uri() . '/page-templates/meineseite.css' );
    }
    }
    add_action( 'wp_enqueue_scripts', 'wpse_enqueue_page_template_styles' );

    Problem: custom template works but not the css

    July 22, 2019 at 9:27 am #492471
    Victor Font
    Moderator

    The get_template_directory_uri() function is probably not retrieving the correct path. This function retrieves the value of template from wp_options. For Genesis style theme's the template value is genesis, the parent theme. So your function is looking for your template in the genesis folder, not authority pro. Use the get_stylesheet_directory_uri() instead.


    Regards,

    Victor
    https://victorfont.com/
    Call us toll free: 844-VIC-FONT (842-3668)
    Have you requested your free website audit yet?

    July 22, 2019 at 10:16 am #492472
    Detlef
    Participant

    Thank you for your quick response ... changed this - but without effect

    July 22, 2019 at 10:37 am #492477
    Victor Font
    Moderator

    It works perfectly for me when I test it in my dev site. Instead of using the is_page_template conditional, what happens if you enqueue the style sheet directly in meineseite.php?


    Regards,

    Victor
    https://victorfont.com/
    Call us toll free: 844-VIC-FONT (842-3668)
    Have you requested your free website audit yet?

    July 22, 2019 at 10:47 am #492479
    Detlef
    Participant

    i will try this one!

    July 22, 2019 at 11:03 am #492482
    Detlef
    Participant

    works perfect!

  • Author
    Posts
Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘Authority Pro: custom css for custom template’ is closed to new replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2023 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble