Jump to content

how does enqueue style work?


tweakimp

Recommended Posts

hi, im new here :)

 

i have a wordpress page for my table tennis club. there is a site with all the current standings and i want to parse a table from it to one of the wordpress pages.

i created a dynamic table with php and styled it with css and javascript. i looks perfectly fine and works just as i want to it to when i run it locally in my broswer.

however, i cant get it to work on the wordpress page.

right now, im trying to embed it with a shortcode so i can embed it anywhere i want, but so far i am not able to apply the css and the javascript to the parsed table.

but the css from the page is applied to the table, i dont want that. also the css and javascript i use in th

i got the advice to use wp_enqueue_scripts, but i dont fully understand how it works.

 

the theme i use is hemingway, its free. i am using a child theme of that for the page.

its function.php looks like this

<?php
 
/* Enqueue parent stylesheet first, child stylesheet second*/
function child_theme_s_enqueue_styles() {
 
 $parent_style = 'parent-style';
 
 wp_enqueue_style( $parent_style, get_template_directory_uri() . '/style.css' );
 wp_enqueue_style( 'child-style',
 get_stylesheet_directory_uri() . '/style.css',
 array( $parent_style )
 );
}
add_action( 'wp_enqueue_scripts', 'child_theme_s_enqueue_styles' );

so it already has enqueue style in it and i dont know how to add the infomation i need to make the custom css and js work without breaking the old code.

 

also: is there a better way to do this?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.