Try Code Snippet plugin. It has been designed in order to avoid creating child themes.
Most issues, which you would like to add to the functions.php of your child theme, you can do by using Code Snippet plugin. It is much more flexible. You can create several versions of your code and active/deactivate them. If some fails, just delete a snippet!
If you need something to a certain page, use this condition:
$currentUrl=’https://’ . $_SERVER[‘HTTP_HOST’] . $_SERVER[‘REQUEST_URI’];
if($curretUrl==”) // the page, where you want to show the code
you can strip $currentUrl with some additional code in order to avoid using the whole web address.
$currentUrl=substr ($currentUrl,30) // 30: the number of characters in the base address of your site. If you have page name ‘guidance’, now you can set condition
if($curretUrl==’guidance’){
add_filter(…..) // add here function what you want to add to a page.
}
add_filter relates with the main content area (adds text before or after content, which as been marked as class=”entry-content”). There might be a way to alter the slider also. I just don’t know if it is possible or not. It needs a hook to use Code Snipper in order to make changes to the slider. If there is no hooks, you must use child theme.
I assume that you can create an own function, which calls the featured slider.
then call your own function with add_filter function.
If you use in your own code
echo $content
add_filter adds the content to the top of the page. If you use
return $content
it adds the code to the bottom of the page.
Don’t ask me why but I have just find, that add_filter behaves at this way.
I just recommend to find, which function defines the featured slider.
Just try to call it by using add_filter function in certain page
add_filter( ‘the_content’, ‘here-function-which-return-featured-slider’,10);
-
This reply was modified 5 years, 7 months ago by tapiohuuhaa.