Notice: These forums are now retired and closed. For active support, please Submit a Ticket or visit our official WordPress.org community pages.
Kadence Theme | Kadence Blocks | Starter Templates | WooCommerce Email Designer | Ascend | Virtue | Pinnacle

How to include a css file wp_enqueue_style to a page template?

Home / Forums / Kadence Theme / How to include a css file wp_enqueue_style to a page template?

This topic is: Resolved
[Resolved]
Posted in: Kadence Theme
April 13, 2022 at 4:09 am

How to include a css file to a page?
I want to include css file the wordpress way i get an error with kadence namespace and print styles uncommented, i can include everything in oceanwp
here is my code, what i`m doing wrong? Thanks

/*
Template Name: Sample page
*/
/**
* The main single item template file.
*
* @package kadence
*/

namespace Kadence;

if ( ! defined( 'ABSPATH' ) ) {
exit;
}

function theme_cms_public_template_assets() {
wp_enqueue_style('mm.public.template.style', get_stylesheet_directory_uri() . '/assets/css/style-2022-04-07-4.min.css', [], 1.0, 'all');
}

add_action('wp_enqueue_scripts', 'theme_cms_public_template_assets', 1100);

//

get_header();

kadence()->print_styles( 'kadence-content' );
/**
* Hook for everything, makes for better elementor theming support.
*/
do_action( 'kadence_single' );

echo "some content";

get_footer();

if kadence namespace and print styles commented out it works :

/*
Template Name: Sample page
*/
/**
* The main single item template file.
*
* @package kadence
*/

// namespace Kadence;

if ( ! defined( 'ABSPATH' ) ) {
exit;
}

function theme_cms_public_template_assets() {
wp_enqueue_style('mm.public.template.style', get_stylesheet_directory_uri() . '/assets/css/style-2022-04-07-4.min.css', [], 1.0, 'all');
}

add_action('wp_enqueue_scripts', 'theme_cms_public_template_assets', 1100);

//

get_header();

// kadence()->print_styles( 'kadence-content' );
/**
* Hook for everything, makes for better elementor theming support.
*/
do_action( 'kadence_single' );

echo "some content";

get_footer();

  • The forum ‘Kadence Theme’ is closed to new topics and replies.