Tagged: x
-
AuthorPosts
-
February 19, 2017 at 1:44 am #1376811
JfantasyBooksParticipantHello Again!,
Details:
Name: JFantasyBooks
Site: Fantasy-Books
Site Url: https://fantasy-books.live
WordPress Version: 4.7.1
X Version: 4.6.4
Cornerstone Plugin Version: 1.33
Problem:So I have ads in which I place at the top of my site via php. Only thing is, the space at the top is constant. So, before the ad loads or if the users use an Adblocker, there is this huge gap of white space with no content that they can see. And it looks awful.
I’ve seen some other sites where they can insert the ad where it is now, but with Javascript. That way, it only activates when the ad loads. Thereby solving my problem.
Can You help me with this javascript?
It’s theme related. I have had help with putting something above the fold but below the navbar before, only now I think that with Javascript, it would better suite my needs.
I’d greatly appreciate your help.
Thanks.
February 19, 2017 at 3:08 am #1376887
ChristianModeratorHey there,
It sounds like you might be having an issue with a third party plugin or script. Regretfully, we cannot provide support for third party plugins or scripts as our support policy in the sidebar states due to the fact that there is simply no way to account for all of the potential variables at play when using another developer’s plugin or script. Because of this, any questions you have regarding setup, integration, or troubleshooting any piece of functionality that is not native to X will need to be directed to the original developer.
Thank you for your understanding.
February 19, 2017 at 10:19 am #1377144
JfantasyBooksParticipantThis is not a plugin issue. I think there is a misunderstanding.
I’d like to be able to put something at the top of my home page and posts, but through the use of Javascript instead of php.
The php code works fine, it’s just I realized that when I am using mobile, which is slower to load pages, or when I am using an adblock and my ads don’t show that it leaves a large blank space.
That’s why I want to do the same thing but through JavaScript instead of php. Because JavaScript will wait until the page loads. And if there is adblock, the space will not generate at all.
An example of this is at wuxiaworld.com where if you look at the advertisement at the top, it waits until the page has finished loading to show the ad. And if there is ad block, it won’t show the space at all. This is all done because they did it through javascript instead of php.
This is my php below:
function displayads() { if(is_home() || is_single()): ?> <div class="custom-banner"> <div class="x-container-fluid max width"> <div align="center"> <?php echo do_shortcode('<script> I entered my script here </script>');?> </div> </div> </div> <?php endif; } add_action('x_after_view_ethos__breadcrumbs','displayads', 30); add_action('x_after_the_content_end', 'displayads');February 19, 2017 at 10:39 am #1377158
ThaiModeratorHi There,
Please try with this code instead:
function displayads() { if(is_home() || is_single()): ?> <div class="custom-banner"> <div class="x-container-fluid max width"> <div align="center"> <script> I entered my script here</script> </div> </div> </div> <?php endif; } add_action('x_after_view_ethos__breadcrumbs','displayads', 30); add_action('x_after_the_content_end', 'displayads');Hope it helps 🙂
February 19, 2017 at 11:14 am #1377189
JfantasyBooksParticipantoh! I guess I didn’t need to use javascript. Thanks!
February 19, 2017 at 6:31 pm #1377453
RadModeratorYou’re welcome!
-
AuthorPosts
- <script> jQuery(function($){ $("#no-reply-1376811 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>
