Files
wingedit.pl/wp-content/themes/restly-child/functions.php
2024-11-04 20:48:19 +01:00

47 lines
1.9 KiB
PHP

<?php
add_action( 'wp_enqueue_scripts', 'intech_child_scripts' );
function intech_child_scripts() {
$parent_style = 'restly-style';
// lets remove the traces of existing stylesheet declaration on the parent theme
wp_dequeue_style( $parent_style );
wp_deregister_style( $parent_style );
// let's override the parent style to point to the correct file
wp_enqueue_style( $parent_style, get_parent_theme_file_uri( 'style.css' ) );
// now let's include child theme's stylesheet after parent's
wp_enqueue_style( 'child-style',
get_theme_file_uri( 'style.css' ),
array( $parent_style ),
filemtime( get_theme_file_path( 'style.css' ) )
);
}
function own_custom_css() {
wp_enqueue_style('cookie-cookienoticepro-style', get_template_directory_uri() . '-child/plugins/CookieNoticePro/cookienoticepro.style.css', array(), '1.0', 'all');
wp_enqueue_style('own-custom-style', get_template_directory_uri() . '-child/assets/styles/custom.css');
}
add_action('wp_enqueue_scripts', 'own_custom_css');
function own_custom_scripts() {
wp_enqueue_script('cookie-cookienoticepro-js', get_template_directory_uri() . '-child/plugins/CookieNoticePro/cookienoticepro.script.js', array('jquery'), '1.0', true);
wp_enqueue_script('own-custom-script', get_template_directory_uri() . '-child/assets/js/custom.js', array('jquery'), null, true);
}
add_action('wp_enqueue_scripts', 'own_custom_scripts');
function get_current_post_content_shortcode($atts) {
$post_id = get_the_ID();
$post_content = get_post_field('post_content', $post_id);
return $post_content ? $post_content : '';
}
add_shortcode('get_current_post_content', 'get_current_post_content_shortcode');
function add_custom_code_to_head() {
echo '<!-- Custom Code -->' . PHP_EOL;
include __DIR__ . '/plugins/CookieNoticePro/cookies.php';
echo '<!-- End Custom Code -->' . PHP_EOL;
}
add_action('wp_head', 'add_custom_code_to_head');