garfield.ir
Forum Replies Created
Viewing 6 replies - 1 through 6 (of 6 total)
-
Forum: Reviews
In reply to: [Widget Content Blocks] Feature request (a simple link)Commit 2: fix showing error, ID not exists.
@@ -27,31 +27,39 @@ class WYSIWYG_Widgets_Widget extends WP_Widget { $show_title = (isset($instance['show_title'])) ? $instance['show_title'] : 1; $post = get_post( $id ); - if( ! empty( $id ) && $post && ! empty( $post->post_content ) ) { + if( ! empty( $id ) && $post ) { + + if ( ! empty( $post->post_content ) ) { echo $args['before_widget']; @@ -27,31 +27,39 @@ class WYSIWYG_Widgets_Widget extends WP_Widget { echo $args['after_widget']; echo '<!-- / WYSIWYG Widgets -->'; + + } else { + if ( current_user_can( 'manage_options' ) ) { + echo '<a target="_blank" class="wysiwyg-widgets-edit-link" href="' . get_edit_post_link( $id ) . '">' . __( 'Edit Widget Block', + 'wysiwyg-widgets' ) . '</a>'; + } + }
- This reply was modified 8 years, 4 months ago by garfield.ir.
Forum: Reviews
In reply to: [Widget Content Blocks] Feature request (a simple link)Hope you forgive me. I tweaked it a little bit. May this will be useful for you too.
@@ -7,13 +7,13 @@ class WYSIWYG_Widgets_Widget extends WP_Widget { */ public function __construct() { parent::__construct( - 'Widget Blocks Widget', // Name + __('Widget Blocks Widget', 'wysiwyg-widgets'), // Name array( 'description' => __('Displays one of your Widget Blocks.', 'wysiwyg-widgets') ) // Args ); } @@ -27,10 +27,9 @@ class WYSIWYG_Widgets_Widget extends WP_Widget { $show_title = (isset($instance['show_title'])) ? $instance['show_title'] : 1; $post = get_post( $id ); - echo $args['before_widget']; - - if( ! empty( $id ) && $post ) { + + if( ! empty( $id ) && $post && ! empty( $post->post_content ) ) { + echo $args['before_widget']; // Allow filtering of content $content = apply_filters( 'ww_content', $post->post_content, $id ); @@ -45,6 +44,12 @@ class WYSIWYG_Widgets_Widget extends WP_Widget { } echo $content; + + if ( current_user_can( 'manage_options' )) { + echo '<a target="_blank" class="wysiwyg-widgets-edit-link" href="' . get_edit_post_link($id) . '">' . __('Edit Widget Block', 'wysiwyg-widgets') . '</a>'; + } + + echo $args['after_widget']; echo '<!-- / WYSIWYG Widgets -->'; } elseif( current_user_can( 'manage_options' ) ) { ?> @@ -55,11 +60,9 @@ class WYSIWYG_Widgets_Widget extends WP_Widget { printf( __( 'No widget block found with ID %d, please select an existing Widget Block in the widget settings.', 'wysiwyg-widgets' ), $id ); } ?> </p> <?php } - echo $args['after_widget']; } @@ -96,13 +99,13 @@ class WYSIWYG_Widgets_Widget extends WP_Widget { $show_title = ( isset( $instance['show_title'] ) ) ? $instance['show_title'] : 1; $selected_widget_id = ( isset( $instance['wysiwyg-widget-id'] ) ) ? $instance['wysiwyg-widget-id'] : 0; - $title = ($selected_widget_id) ? get_the_title( $selected_widget_id ) : 'No widget block selected.'; + $title = ($selected_widget_id) ? get_the_title( $selected_widget_id ) : __('No widget block selected.' , 'wysiwyg-widgets' ); ?> @@ -120,9 +123,10 @@ class WYSIWYG_Widgets_Widget extends WP_Widget { <p> <label><input type="checkbox" id="<?php echo $this->get_field_id( 'show_title' ); ?>" name="<?php echo $this->get_field_name( 'show_title' ); ?>" value="1" <?php checked( $show_title, 1 ); ?> /> <?php _e( "Show title?", "wysiwyg-widgets" ); ?></label> </p> + <p class="help"><?php printf( __( 'Edit widget block: %s', 'wysiwyg-widgets' ), '<a target="_blank" href="' . get_edit_post_link($selected_widget_id) . '">' . $title . '</a>' ); ?></p> <p class="help"><?php printf( __( 'Manage your widget blocks %shere%s', 'wysiwyg-widgets' ), '<a href="'. admin_url( 'edit.php?post_type=wysiwyg-widget' ) .'">', '</a>' ); ?></p> <?php }
Forum: Reviews
In reply to: [Widget Content Blocks] Feature request (a simple link)May I ask you add these lines to the same file at line 48 too ?
if ( current_user_can( 'manage_options' )) { echo '<a target="_blank" class="wysiwyg-widgets-edit-link" href="' . get_edit_post_link($id) . '">' . __('Edit Widget Block', 'wysiwyg-widgets') . '</a>'; }
Forum: Reviews
In reply to: [Widget Content Blocks] Feature request (a simple link)That was easy
<p class="help"><?php printf( __( 'Edit widget block: %s', 'wysiwyg-widgets' ), '<a target="_blank" href="' . get_edit_post_link($selected_widget_id) . '">' . $title . '</a>' ); ?></p>
I will be thankful if you add it to file “class-widget.php” line 123
Best Regards
Forum: Fixing WordPress
In reply to: More tag doesn’t working in RSSit doesn’t work. where should I edit the configs?
Forum: Plugins
In reply to: RSS disable the “more” tag?I need just the opposite thing. I need to hide the More part of my blog from RSS feeds. but I can’t do it in WP2.5.1. what should I do?
Viewing 6 replies - 1 through 6 (of 6 total)