• 0
Sign in to follow this  
Followers 0

DMS 2 Something in DMS is preventing a jQuery -based section from working


Question

Posted (edited) · Report post

I'm trying to create an instagram widget section.
It's based on https://github.com/pavelk2/social-feed
Demo: http://pavelk2.github.io/social-feed/

Here is my section.php code (it's formatted so you can just create a new section and copy-paste it - all .js etc are loaded from external page for simplification)
 

<?php
/*
Section: social feed
Author: Ketri
Author URI: http://petripottonen.com
Description: Just trying stuff
Class Name: socialFeed
Workswith: templates, main, header, morefoot, content
Cloning: true
Filter: component
Loading: refresh
*/

/*
 * Main section class
 *
 * @package PageLines DMS
 * @author PageLines
 */
class socialFeed extends PageLinesSection {
 function section_styles(){
        // This will load the 'cooljavascript.js' file from the current section folder
       // wp_enqueue_script( 'doT.min.js', $this->base_url.'/doT.min.js', array( 'jquery' ), PL_CORE_VERSION, true );
       // wp_enqueue_script( 'moment', $this->base_url.'/moment.js', array( 'jquery' ), PL_CORE_VERSION, true );
       // wp_enqueue_script( 'socialfeed', $this->base_url.'/jquery.socialfeed.js', array( 'jquery' ), PL_CORE_VERSION, true );
    }

/**
* Section template.
*/

   function section_template() {
    $categoryName = $this->opt( 'pagelines_categoryloop_category', $this->tset );
$numberOfPosts = $this->opt( 'pagelines_herounit_tagline', $this->tset );
$catOrCMP = $this->opt( 'herounit_category_or_cpt', $this->tset );
?>
        <div class="social-feed-container"></div>

    <!-- doT.js for rendering templates and moment.js for showing time ago -->
    <!--<script src="dependencies/doT.min.js"></script>
    <script src="dependencies/moment.min.js"></script>
  
    <script src="js/jquery.socialfeed.js"></script>-->


    <script src="http://petripottonen.com/social-feed2/dependencies/doT.min.js"></script>
    <script src="http://petripottonen.com/social-feed2/dependencies/moment.min.js"></script>
    <script src="http://petripottonen.com/social-feed2/js/jquery.socialfeed.js"></script>
    

    <script>
    jQuery(document).ready(function(){
        jQuery('.social-feed-container').socialfeed({
                    //FACEBOOK--------------------
                    facebook:{
                        accounts:['teslamotors'], //usernames or id
                        limit:2,
                        token:'240696342763428|FgHgjfn7wWMNT15ONHP0tVdWm_k' //you can also create an app and put  here your 'APP ID|APP SECRET' - it is easier but not safe
                    },
                    //VK--------------------
                    vk:{
                        accounts:[125936523], //id for users and -id (with minus) for groups 
                        limit:2,
                        source:'all'
                    },
                    //GOOGLEPLUS-------------------
                    google:{
                         access_token: 'AIzaSyA_lDYGTnTiEjhzjvkxX1KZnouhbVQ0QUU', //AIzaSyA_lDYGTnTiEjhzjvkxX1KZnouhbVQ0QUU
                         accounts: ['111435337725041517235','114461178896543099856','+TeslaMotors'],
                         limit: 2
                     },
                    //INSTAGRAM---------------------
                    instagram:{
                        accounts:[297604134], //userid
                        client_id:'2c6d2173ae9d41de905236e6301e5a43', //2c6d2173ae9d41de905236e6301e5a43
                        limit:2
                    },
                    //GENERAL SETTINGS--------------
                    length:130,
                    show_media:true,
                    callback: function(){
                        console.log('all posts are collected');
                    }
                });
});
</script>
    
<?php 


}


}

 

 

It does not work.

BUT the strange thing is, that if I copy-paste the functional part of the code to a blank -html -file, it works. 
In fact, even if I copy paste the entire code that shows in my DMS, the whole thing and copy-paste it to a blank .html, the section then works! 
What could be the problem?

Thank you. 

Edited by ketri

Share this post


Link to post
Share on other sites

1 answer to this question

  • 0

Posted · Report post

1. please dont post huge bits of code in the forum, it doesnt render it at all well, use a gist, pastebin, or even the pastebin here on the forum

2. please give us a url where this section is installed so we can see whatever error it is producing

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0