Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion lptw-recent-posts.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ function lptw_recent_posts_register_scripts() {

wp_enqueue_script( 'lptw-recent-posts-script', plugins_url( 'lptw-recent-posts.js', __FILE__ ), array('jquery', 'jquery-masonry'), false, true );
}
add_action( 'wp_enqueue_scripts', 'lptw_recent_posts_register_scripts' );
//Not using Add Action anymore, as the function loading Scripts and CSS is called directly from Widget and from ShortCode initialization
//add_action( 'wp_enqueue_scripts', 'lptw_recent_posts_register_scripts' );

/* register custom image size for Grid Layout */
function lptw_recent_posts_activate () {
Expand Down Expand Up @@ -140,6 +141,8 @@ function lptw_recent_posts_options_save_meta_box_data( $post_id ) {

/* Register and load the widget */
function lptw_recent_posts_load_widget() {
//Scripts and CSS are loaded only when the widget is initialized.
lptw_recent_posts_register_scripts();
register_widget( 'lptw_recent_posts_fluid_images_widget' );
register_widget( 'lptw_recent_posts_thumbnails_widget' );
}
Expand All @@ -153,6 +156,9 @@ function lptw_recent_posts_load_widget() {
include( plugin_dir_path( __FILE__ ) . 'includes/class.render.layout.php');

function lptw_display_recent_posts ( $atts ) {
//Scripts and CSS are loaded only when the [lptw_recentposts] shortcode is called at the page.
lptw_recent_posts_register_scripts();

$default_posts_per_page = get_option( 'posts_per_page', '10' );

$a = shortcode_atts( array(
Expand Down