-
AuthorPosts
-
August 4, 2014 at 7:14 pm #299825
I’ve tried using the transparency option to display my slider in the header region, but I don’t like how it affects the right sidebar and the main menu. I’d really just like to replace the header background image in header_main with my slider, but I’m not sure how to do so. Edit a template file? If so… which one. Any way to stick shortcode or php into that header slot?
Thanks!
August 5, 2014 at 2:45 am #299968Hey Eric!
There are some hooks that let you insert content in the header area, try with something like this in your theme / child theme functions.php:
function add_stuff_to_header_func() { ?> HTML_CONTENT_HERE <?php } add_action('ava_after_main_menu', 'add_stuff_to_header_func');
That will add content inside the header container, if you want it outside, use:
function add_stuff_to_header_func() { ?> HTML_CONTENT_HERE <?php } add_action('ava_main_header', 'add_stuff_to_header_func');
You can use the do_shortcode function to reproduce a LayerSlider using this method.
Best regards,
JosueAugust 5, 2014 at 3:13 pm #300259Perfect. Thank you.
Got the HTML content in there and was successful putting a background picture and styling its position.
Can’t get the do_shortcode bit to work. Tried this… still got just the shortcode in square brackets outputted.function emj_header_func() { ?> <div id="emjheader"><?php echo do_shortcode('[layerslider id="3"]'); ?></div> <?php } add_action('ava_after_main_menu', 'emj_header_func');
Layer slider also provides an optional function:
<?php layerslider(3) ?>
But when I called it via my function above, it outputted an error that it couldn’t find that function.Ideas?
August 5, 2014 at 7:55 pm #300393Hey!
I’ve tested this code on my sandbox installations and it does work. I’d suggest trying the following:
– Increase the memory allocated to PHP: http://codex.wordpress.org/Editing_wp-config.php#Increasing_memory_allocated_to_PHP
– Disable all third-party plugin and see if the LS comes up.Regards,
JosueAugust 5, 2014 at 9:05 pm #300405Increased memory to 128M – No Dice.
Disabled all plugins – No Dice.Any chance other items in functions.php (child) are causing problems?
<?php add_filter('avf_blog_style','avia_change_archive_blog_layout', 10, 2); function avia_change_archive_blog_layout($layout, $context){ if($context == 'archive') $layout = 'blog-grid'; return $layout; } add_filter('the_excerpt', 'do_shortcode'); function emj_header_func() { echo do_shortcode('[layerslider id="3"]'); } add_action('ava_after_main_menu', 'emj_header_func'); ?>
Do I need to add a filter regarding the shortcode?
Is it possible I have to call up the layerslider function prior to this function? (think it is already called elsewhere).
See next post for some private info.Thanks for your assistance.
August 5, 2014 at 9:07 pm #300406This reply has been marked as private.August 5, 2014 at 9:14 pm #300409Hi Eric!
The login you posted are not working.
Regards,
JosueAugust 6, 2014 at 2:28 am #300465This reply has been marked as private.August 6, 2014 at 7:22 am #300531OK, after some additional fishing, problem solved. See posts:
https://kriesi.at/support/topic/layerslider-shortocode-disabled/#post-187266
https://kriesi.at/support/topic/layerslider-not-working-2/I purchased the standalone layerslider and disabled the functions.php line… working as expected. Not thrilled with spending another $17… but I”ve lost that much problem solving.
However, the links above call for commenting out the layerslider line in functions.php of the parent theme. That means, everytime I update, I have to correct this problem. How can I “unhook” that line in my child theme’s functions.php file so I don’t have to watch this carefully?
Thanks in Advance…
August 6, 2014 at 7:40 am #300536Hey!
Try putting this line in your child function.php:
add_theme_support('deactivate_layerslider');
Cheers!
JosueAugust 6, 2014 at 7:56 am #300537Perfect… that did it. Strange that the other post suggests hacking the theme before modifying the child. Anyway, you’ve been very helpful. Best wishes to you. You can close this thread if you like – the issue is resolved on my end.
August 6, 2014 at 8:13 am #300539You are welcome, always glad to help :)
Regards,
Josue -
AuthorPosts
- The topic ‘LayerSlider WP in header_main’ is closed to new replies.