Jump to content

Archived

This topic is now archived and is closed to further replies.

thebastion

jQuery blown up front end editor

Recommended Posts

thebastion    20
thebastion

So I have been trying to add a simple bit of jQuery into the page, it needs to go at the bottom of the body and not the header.
 
I initially added it to the custom code (header) section but that locked up the front end editor. I then found that you can remove it by going to the dashboard/pagelines/DMS Tools/DMS Header Scripts Fallback. I removed it and then the editor worked again.
 
I then tried adding a textbox to the footer and adding the code, now the editor is fully locked and I cannot do anything. I'm using Nicks base theme V1.2 and this is the simple bit of code I entered:

 

<script>
        jQuery(document).ready(function() {
            jQuery("#portfolio-list").filterable();
        });
</script>

 

Any ideas how to fix this other than making a child theme again and also how woul i go about adding this bit of jQuery onto a page BOT in the header?

 

Cheers

Share this post


Link to post
Share on other sites
thebastion    20
thebastion

So after deleting the child theme and reactivating DMS, the problem was still there. I then deleted DMS completely and reinstalled but the issue of not having the front end editor is still there. What next?

Share this post


Link to post
Share on other sites
thebastion    20
thebastion

I managed to fix this by visiting the default set up "Sample Page", the editor was now working so I used the "Undo all" option and saved. Then went back to the homepage and the editor was working again.

 

I guess I should add the jquery to the footer.php and avoid adding any into the page.

Share this post


Link to post
Share on other sites
Danny    1,327
Danny
No you shouldn't edit core files, by doing so, you void all support and will most likely break DMS. I recommend you use a hook - http://docs.pagelines.com/advanced/hooks
pagelines_before_footer

Please search our forums, before posting!

Share this post


Link to post
Share on other sites
thebastion    20
thebastion

footer.php in the child theme I created not the core files. Hence me creating a child theme to not mess with the core files.

Share this post


Link to post
Share on other sites
Rob    547
Rob

If it's your own child theme, you can still break DMS by adding that to the footer.php of child theme.  Danny's correct. A hook would be much more appropriate in the child theme's functions.php.  That's what it's there for.


Former PageLines Moderator, Food Expert and Raconteur

Share this post


Link to post
Share on other sites
thebastion    20
thebastion

It's all sorted, you can close this.

Share this post


Link to post
Share on other sites
thebastion    20
thebastion

Actually maybe its a good thing this question is not closed because I have the same issue again. I followed your advice on using the hooks and created this in functions.php:

 

/*--- ADD JQUERY TO FOOTER ---*/
function filterable() {
    if (is_front_page()) {
    echo '<script>
        jQuery(document).ready(function() {
            jQuery("#portfolio-list").filterable();
        });
</script>';
    }
}
add_action('wp_footer', 'filterable');

 

Am I doing this incorrectly? Its adding the script to the footer and working but again its making the visual editor stop working..

Share this post


Link to post
Share on other sites
thebastion    20
thebastion

I forgot to add that I'm also enqueing the script before hand:

/*--- ENQUEUE SCRIPTS ---*/
function enqueue_filterable() {
if (is_front_page()) {
wp_register_script( 'filterable', esc_url( trailingslashit( get_stylesheet_directory_uri() ) . 'js/filterable.js' ), array(), false, false );
wp_enqueue_script( 'filterable' );}
}  
add_action('wp_enqueue_scripts', 'enqueue_filterable');

Share this post


Link to post
Share on other sites
thebastion    20
thebastion

So to advance on my previous problems/questions I have added:

 

/*--- ADD JQUERY TO FOOTER ---*/
function filterable() {
    if (is_front_page()) {
    echo '<script>
        jQuery(document).ready(function() {
            jQuery("#portfolio-list").filterable();
        });
</script>';
    }
}
add_action('pagelines_before_footer', 'filterable');

 

Why didn't I look at the "pagelines_before_footer" bit you mentioned earlier.....

 

I'm not sure if this is still the correct way to do it but anyway It all seems to be working nice now.

 

Is there a page/doc/list anywhere of the available pagelines hooks? The current docs link is very minimal and there was no mention of the "pagelines_before_footer" hook in those docs so I would never have worked that out.

 

Thanks for the help

Stuart

 

P.S I wish there was an EDIT post option in here so that I dont have to keep adding more and more.

Share this post


Link to post
Share on other sites

  • Similar Content

    • JawDesigns
      By JawDesigns
      Hi everyone,
      Flywheel have reported errors on my clients site 'www.racewaredirect.co.uk' and it's not loading. Can someone please provide some information on how to fix this? The site has never experienced these issues before.
      Thanks,
      James Wilson
    • MissT
      By MissT+
      Hi there,
      I've got an issue with 3 websites built with DMS since I migrated them from http to https that I need help with please.
      When any changes are made - e.g. new posts added or existing posts amended - certain sections of the live site seem to break e.g. image headers hang and don't load (b/g on canvas section), sliders hang and don't load (Revslider), flipper section doesn't load.
      Logging in and then clicking 'Edit the site using DMS' seems to fix the problem. Often if I try to open up another browser window to edit the site / re publish I'm unable to as the page wont load / hangs while trying to load.
      Any ideas how to fix this? On a couple of the sites I've installed a caching plugin as I thought it might be a loading speed issue but it's still happening.
      Website URL's can be provided privately.
      Many thanks in advance.
    • jeomiland
      By jeomiland+
      Hi
      I found this topic
      which talks about a similar issue I am having, but a little different. Hope someone can help me out.
      Best way to see the problem is to view http://cassclayton.com/ on Safari (Mac) compared to Firefox or Chrome. You will see the banner just under the fixed menubar has a gap between the menubar and top of the banner. Looking at Inspector, I found:
      <div class="fixed-top-pusher" style="height: 62px;"></div>
      <script> jQuery('.fixed-top-pusher').height( jQuery('.pl-fixed-top').height() ) </script>
      and indeed it seems the jquery is not always working consistently. For instance, if you simply refresh the page in Safari, it will loose the gap and all looks fine, so is it a browser cache issue that is interacting with the jquery? I do have W3 Total Cache installed. There must be a way to tell the code to make sure jquery is up and running and available to do it's majic?
      And perhaps there is just a better way to do this banner? Originally I tried several DMS sections and used the banner image as background, etc... Kept running into problems with resizing and the left/right parts of the image were getting chopped off. It is important the whole image show, so currently I just use a NextBox section with this code:
      <img src="[pl_site_url]/wp-content/uploads/2015/12/CassClayton-blues-tribute-banner.jpg" width="100%" />
      and it looks the way it should. Is there a better way to place a banner graphic under a fixed navbar and make sure the whole banner graphic displays regardless of screensize?
       
    • oseehys
      By oseehys+
      Hello There,
      So i want to use platform 5 and DMS sections on a single page, i am using a child theme with pinspro as my main theme and i activated platform 5, the only problem am having so far is the fixed option, my navbars are not aligning to their default size, and it will be great if platform 5 header and footer section will function, has anyone used this option, how can i make the best use of platform 5 and DMS on a site
      Cheers
    • cas45
      By cas45+
      I am running a site based on PageLines Framework 2.5.0. I am making some changes to a current website and managed to find a script that will do what I want.:
       
      $(".vend-cat").each( function() {
          if ( $(this).find(".no-vendors").html() == '' ) {
                 $(this).hide();
          }
      } );
       
      I have tested it on jsfiddle and it works fine. It does however need to be adapted to work with jQuery for pagelines and wordpress. Any help or advice?
       
      Thanks
×