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

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

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

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
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

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

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

It's all sorted, you can close this.

Share this post


Link to post
Share on other sites
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

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

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

    • MiraAdmin
      By MiraAdmin+
      Looking for some help on a recently developed issue. Editor will not load. 
      Theme:  DMS2
      Error from:  Chrome - Inspector - console view
      Error message: Refused to execute script from 'http://xxxx.xxx/wp-content/themes/dms/dms/editor/js/gettext.js/?ver=4.9.7' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
      Occurs on all sites on same server. 
      WP versions to 4.9.5, 4.9.6, 4.9.7 = same behavior. Worked properly on these same versions until 07/04/2018.
      No new plugins. Isolating plugins offers same behavior. 
      Server vendor reports no changes, patches, etc. 
      Server re-starts no impact.  

      Thank you. 
    • Paul
      By Paul+
      I was surprised to see I had no menu today - out of the blue - its actually moved to the bottom of the page!  After hours of fiddling and disabling every single plugin, leaving just plagelines the issue is still present.  See video for a basic text box - I moved it into the head and it jumps to the bottom and shows just above the footer but below the main content.  I have a temp fix by placing the menu into the first row on the main content but it does mean other than my home page, all other pages have no menu.  A quick fix is very urgent for this bug.
      https://thelaptopfixers.com
       
       
    • Steve Webb
      By Steve Webb+
      I am having an issue with DMS editor not loading.  Just keeps spinning and spinning.
      Have tried several things - Logged in and out, cleared cache, deactivated all plugins, but the issue persists.
      I even had our host restore from a backup a few weeks ago, when I know it WAS working, as I edited a text box on the homepage.  The restore from backup didn't help either.
      Also, the front end of the site shows that the site is framed, or boxed now (whatever you call it), instead of full width as it was previously (last week).
      Dev console shows that there are php errors in Google maps - file is attached.
      Can someone please help?  Not sure what else I can do here...
      Thanks in advance.
      -Matt

    • tuciudadenred
      By tuciudadenred+
      Hi everyone, what happens is that the web page metrosalarmas.com has a google tags which I have not attacked where I can look to remove those tags and be able to locate the correct ones.
×