cschmitt
Forum Replies Created
-
Hi,
that would be PHP 5.6.30 and MySQL 5.7.15
Cheers,
ChristianThanks for your reply. I guess I’ll have to wait then 🙂
Cheers,
ChristianIn dashboard click on “Gallery – Manage Gallery”, select the gallery you want to sort. Click on the “Sort gallery” button. Then, using drag and drop, sort the images to your liking an press the “Update sort order” button. Done!
Cheers,
ChristianForum: Plugins
In reply to: Widget to display one specified postOK, five minute job. No error checking, no styling, no nothing.
Use at your own risk.
Create a new file displaypost.php in your wp-content/plugins directory.
Paste the code below into it.
Activate the plugin.
Drag the widget to your sidebar.
Enter the desired post ID and Bob’s your uncle (I always wanted to use that phrase :))Cheers,
Christian<?php /* Plugin Name: Display Post Plugin URI: http://localhost/wordpress Description: Display the content of a single post in a widget. Author: Christian Schmitt Version: 1 Author URI: http://localhost/wordpress/ */ class DisplayPost extends WP_Widget { function DisplayPost() { $widget_ops = array('description' => "Display the content of a single post in a widget."); $this->WP_Widget('displaypost', 'Display Post', $widget_ops); } function widget($args, $instance) { extract($args); $postId = $instance['postid']; $thePost = get_post($postId); echo $before_widget; echo $before_title . $widget_name . $after_title; echo $thePost ? $thePost->post_content : "Invalid post ID!"; echo $after_widget; } function update($new_instance, $old_instance) { $new_instance = (array) $new_instance; $instance['postid'] = strip_tags($new_instance['postid']); return $instance; } function form($instance) { $instance = wp_parse_args((array) $instance, array('postid' => -1)); $postid = esc_attr($instance['postid']); ?> <p> <label for="<?php echo $this->get_field_id('postid'); ?>">Post ID</label> <input type="text" class="widefat" id="<?php echo $this->get_field_id('postid'); ?>" name="<?php echo $this->get_field_name('postid'); ?>" value="<?php echo $postid; ?>" /> </p> <?php } } function displaypost_init() { register_widget('DisplayPost'); } add_action('widgets_init', 'displaypost_init'); ?>A little follow-up…
The above does not work correctly, if you change NextGEN Gallery’s sorting. Let’s say you sort your gallery so that the 5th image is displayed as the first one. The the above CSS would still show image no. 1, since the id ist still ngg-image-1.This should work better:
div.ngg-gallery-thumbnail-box { display:none; } div.ngg-galleryoverview div:first-child { display:block; } /* Star HTML hack. Styles are only interpreted by IE6 */ * html div.ngg-gallery-thumbnail-box { display:block; }I included the star HTML hack because otherwise you’d see no thumbnail at all in IE6.
Cheers,
ChristianQuick and dirty…
I added these lines to NextGEN Gallery’s stylesheet:
.ngg-gallery-thumbnail-box { display:none; !important;} #ngg-image-1 {display: block; !important;}This hides every thumbnail but the first.
Hope this helps.
Cheers,
Christian