Masonry Plugin Syntax Error
-
Hey together,
I am developing my first plugin, which creats a grid layout with widgets. Now i wanted to integrate masonry for a better look of the floating.Here you can find my site where the syntax error occurs
JUVO Webdesign .I enqueued both the integrated version of masonry and the one via the CDN of the developer.
I have integraded the code snippet from the developer itself to my plugin. If you want to look the plugin code through here it is, and i know this is not the best, as said it is my first coding experience :
<?php /* * Plugin Name: JUVO Grid Portfolio * Plugin URI: https://juvo-design.de/portfolio/ * Description: Plugin that creates a Grid Layout to show a Portfolio * Version: 1.0 * Author: Justin Vogt * Author URI: https://juvo-design.de * License: GPL2 * * @copyright Copyright (c) 2016, Justin Vogt. * @license GPL2+ */ // Include the widget. include_once plugin_dir_path( __FILE__ ) . 'juvo-portfolio-widget.php'; // Include the Options Page. include_once plugin_dir_path( __FILE__ ) . 'juvo_portfolio_options.php'; // Register the widget with WordPress. add_action( 'widgets_init', function(){ register_widget( 'JUVO_Portfolio' ); }); ?> <?php function adding_scripts_styles() { wp_register_script('imagesloadedext','https://npmcdn.com/imagesloaded@4.1/imagesloaded.pkgd.min.js', array('jquery'), true); wp_enqueue_script('imagesloadedext'); wp_enqueue_script('masonry'); } wp_register_style('widget_style', plugins_url('style.css',__FILE__ )); wp_enqueue_style('widget_style'); add_action( 'wp_enqueue_scripts', 'adding_scripts_styles' ); register_sidebar( array( 'name' => 'Portfolio', 'id' => 'portfolio', 'description' => 'Sidebar zur Darstellung der Portolio Widgets', 'class' => 'portfolio_wrapper', 'before_title' => '<h2 class="rounded">', 'after_title' => '</h2>', ) ); //[portfolio] function sidebar_portfolio( $atts ){ ob_start(); dynamic_sidebar( 'portfolio' ); $out1 = ob_get_contents(); ob_end_clean(); return <<<HTML <div class="portfolio_wrapper">{$out1} <script> // init Masonry var $grid = $('.portfolio_wrapper').masonry({ // options... itemSelector: '.portfolio_widget', columnWidth: 200 }); // layout Masonry after each image loads $grid.imagesLoaded().progress( function() { $grid.masonry('layout'); }); </script> </div> HTML; ?> <?php } add_shortcode( 'portfolio', 'sidebar_portfolio' ); function juvo_portfolio_options_add_page() { add_options_page( __( 'JUVO Portfolio', 'dorayaki' ), // Name of page __( 'JUVO Portfolio', 'dorayaki' ), // Label in menu 'manage_options', // Capability required 'juvo_portfolio', // Menu slug, used to uniquely identify the page 'juvo_portfolio_options' // Function that renders the options page ); } add_action( 'admin_menu', 'juvo_portfolio_options_add_page' ); ?>
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
The topic ‘Masonry Plugin Syntax Error’ is closed to new replies.