Version Description
The plugin has been translated into Dutch and German. Hat tip: Caspar Hübinger - glueckpress.com
=
Download this release
Release Info
Developer | vanderwijk |
Plugin | Content Blocks (Custom Post Widget) |
Version | 1.4 |
Comparing to | |
See all releases |
Code changes from version 1.2 to 1.4
- custom-post-widget.php +39 -138
- languages/custom-post-widget-de_DE.mo +0 -0
- languages/custom-post-widget-de_DE.po +171 -0
- languages/custom-post-widget-nl_NL.mo +0 -0
- languages/custom-post-widget-nl_NL.po +170 -0
- languages/custom-post-widget-xx_XX.pot +1 -0
- post-widget.php +142 -0
- readme.txt +7 -5
- screenshot-1.png +0 -0
- screenshot-2.png +0 -0
custom-post-widget.php
CHANGED
@@ -3,153 +3,54 @@
|
|
3 |
Plugin Name: Custom Post Widget
|
4 |
Plugin URI: http://www.vanderwijk.com/services/web-design/wordpress-custom-post-widget/
|
5 |
Description: Show the content of a custom post of the type 'content_block' in a widget.
|
6 |
-
Version: 1.
|
7 |
Author: Johan van der Wijk
|
8 |
Author URI: http://www.vanderwijk.com
|
9 |
-
|
10 |
-
|
11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
*/
|
13 |
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
function custom_post_widget()
|
18 |
-
{
|
19 |
-
$widget_ops = array('description' => __('Displays custom post content in a widget'));
|
20 |
-
$this->WP_Widget('custom_post_widget', __('Content Block'), $widget_ops);
|
21 |
-
}
|
22 |
-
|
23 |
-
function form($instance)
|
24 |
-
{
|
25 |
-
$custom_post_id = esc_attr($instance['custom_post_id']);
|
26 |
-
$show_custom_post_title = isset($instance['show_custom_post_title ']) ? $instance['show_custom_post_title '] : true;
|
27 |
-
|
28 |
-
?>
|
29 |
-
<p>
|
30 |
-
<label for="<?php echo $this->get_field_id('custom_post_id'); ?>"> <?php echo __('Content Block to Display:') ?>
|
31 |
-
<select class="widefat" id="<?php echo $this->get_field_id('custom_post_id'); ?>" name="<?php echo $this->get_field_name('custom_post_id'); ?>">
|
32 |
-
<?php query_posts('post_type=content_block&orderby=ID&order=ASC&showposts=-1');
|
33 |
-
if ( have_posts() ) : while ( have_posts() ) : the_post();
|
34 |
-
$currentID = get_the_ID();
|
35 |
-
if($currentID == $custom_post_id)
|
36 |
-
$extra = 'selected' and
|
37 |
-
$widgetExtraTitle = get_the_title();
|
38 |
-
else
|
39 |
-
$extra = '';
|
40 |
-
echo '<option value="'.$currentID.'" '.$extra.'>'.get_the_title().'</option>';
|
41 |
-
endwhile; else:
|
42 |
-
echo '<option value="empty">No content blocks available</option>';
|
43 |
-
endif;
|
44 |
-
?>
|
45 |
-
</select>
|
46 |
-
</label>
|
47 |
-
</p>
|
48 |
-
<?php ?>
|
49 |
-
<input type="hidden" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php echo $widgetExtraTitle; ?>" />
|
50 |
-
<?php wp_reset_query(); ?>
|
51 |
-
|
52 |
-
<p>
|
53 |
-
<input class="checkbox" type="checkbox" <?php checked( (bool) $instance['show_custom_post_title'], true ); ?> id="<?php echo $this->get_field_id( 'show_custom_post_title' ); ?>" name="<?php echo $this->get_field_name( 'show_custom_post_title' ); ?>" />
|
54 |
-
<label for="<?php echo $this->get_field_id( 'show_custom_post_title' ); ?>"><?php echo __('Show Post Title') ?></label>
|
55 |
-
</p>
|
56 |
|
57 |
-
|
58 |
-
|
59 |
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
return $instance;
|
67 |
-
}
|
68 |
-
|
69 |
-
function widget($args, $instance)
|
70 |
-
{
|
71 |
-
extract($args);
|
72 |
-
|
73 |
-
$custom_post_id = ( $instance['custom_post_id'] != '' ) ? esc_attr($instance['custom_post_id']) : 'Zoeken';
|
74 |
-
|
75 |
-
/* Our variables from the widget settings. */
|
76 |
-
$show_custom_post_title = isset( $instance['show_custom_post_title'] ) ? $instance['show_custom_post_title'] : false;
|
77 |
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
// Output the query to find the custom post
|
82 |
-
query_posts( 'post_type=content_block&p=' . $custom_post_id );
|
83 |
-
while (have_posts()) : the_post();
|
84 |
-
|
85 |
-
if ( $show_custom_post_title )
|
86 |
-
echo the_title($before_title, $after_title); // This is the line that displays the title
|
87 |
-
|
88 |
-
echo the_content();
|
89 |
-
endwhile;
|
90 |
-
wp_reset_query();
|
91 |
|
92 |
-
|
93 |
-
echo $after_widget;
|
94 |
-
}
|
95 |
}
|
96 |
-
add_action('widgets_init', create_function('', 'return register_widget("custom_post_widget");'));
|
97 |
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
'name' => _x('Content Blocks', 'post type general name'),
|
106 |
-
'singular_name' => _x('Content Block', 'post type singular name'),
|
107 |
-
'add_new' => _x('Add Content Block', 'block'),
|
108 |
-
'add_new_item' => __('Add New Content Block'),
|
109 |
-
'edit_item' => __('Edit Content Block'),
|
110 |
-
'new_item' => __('New Content Block'),
|
111 |
-
'view_item' => __('View Content Block'),
|
112 |
-
'search_items' => __('Search Content Blocks'),
|
113 |
-
'not_found' => __('No Content Blocks Found'),
|
114 |
-
'not_found_in_trash' => __('No Content Blocks found in Trash'),
|
115 |
-
'parent_item_colon' => ''
|
116 |
-
);
|
117 |
-
$options = array(
|
118 |
-
'labels' => $labels,
|
119 |
-
'public' => false,
|
120 |
-
'publicly_queryable' => false,
|
121 |
-
'exclude_from_search' => true,
|
122 |
-
'show_ui' => true,
|
123 |
-
'query_var' => true,
|
124 |
-
'rewrite' => true,
|
125 |
-
'capability_type' => 'post',
|
126 |
-
'hierarchical' => false,
|
127 |
-
'menu_position' => null,
|
128 |
-
'supports' => array('title','editor','revisions','thumbnail')
|
129 |
-
);
|
130 |
-
register_post_type('content_block',$options);
|
131 |
-
}
|
132 |
-
|
133 |
-
add_filter('post_updated_messages', 'content_block_messages');
|
134 |
-
|
135 |
-
function content_block_messages( $messages ) {
|
136 |
-
|
137 |
-
$messages['content_block'] = array(
|
138 |
-
0 => '',
|
139 |
-
1 => sprintf( __('Content Block updated. <a href="%s">View Content Block</a>'), esc_url( get_permalink($post_ID) ) ),
|
140 |
-
2 => __('Custom field updated.'),
|
141 |
-
3 => __('Custom field deleted.'),
|
142 |
-
4 => __('Content Block updated.'),
|
143 |
-
5 => isset($_GET['revision']) ? sprintf( __('Content Block restored to revision from %s'), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
|
144 |
-
6 => sprintf( __('Content Block published. <a href="%s">View Content Block</a>'), esc_url( get_permalink($post_ID) ) ),
|
145 |
-
7 => __('Block saved.'),
|
146 |
-
8 => sprintf( __('Content Block submitted. <a target="_blank" href="%s">Preview Content Block</a>'), esc_url( add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ) ),
|
147 |
-
9 => sprintf( __('Content Block scheduled for: <strong>%1$s</strong>. <a target="_blank" href="%2$s">Preview block</a>'),
|
148 |
-
date_i18n( __( 'M j, Y @ G:i' ), strtotime( $post->post_date ) ), esc_url( get_permalink($post_ID) ) ),
|
149 |
-
10 => sprintf( __('Content Block draft updated. <a target="_blank" href="%s">Preview Content Block</a>'), esc_url( add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ) ),
|
150 |
-
);
|
151 |
-
|
152 |
-
return $messages;
|
153 |
-
}
|
154 |
|
155 |
?>
|
3 |
Plugin Name: Custom Post Widget
|
4 |
Plugin URI: http://www.vanderwijk.com/services/web-design/wordpress-custom-post-widget/
|
5 |
Description: Show the content of a custom post of the type 'content_block' in a widget.
|
6 |
+
Version: 1.4
|
7 |
Author: Johan van der Wijk
|
8 |
Author URI: http://www.vanderwijk.com
|
9 |
+
License: GPL2
|
10 |
+
|
11 |
+
Release notes: 1.4 Thanks to Caspar from GlückPress (http://glueckpress.com) the Custom Post Widget plugin is now fully localized.
|
12 |
+
|
13 |
+
Copyright 2011 Johan van der Wijk (email: info@vanderwijk.com)
|
14 |
+
|
15 |
+
This program is free software; you can redistribute it and/or modify
|
16 |
+
it under the terms of the GNU General Public License, version 2, as
|
17 |
+
published by the Free Software Foundation.
|
18 |
+
|
19 |
+
This program is distributed in the hope that it will be useful,
|
20 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
21 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
22 |
+
GNU General Public License for more details.
|
23 |
+
|
24 |
+
You should have received a copy of the GNU General Public License
|
25 |
+
along with this program; if not, write to the Free Software
|
26 |
+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
27 |
*/
|
28 |
|
29 |
+
/* Set constant path to the custom-post-widget plugin directory. */
|
30 |
+
define( 'CUSTOM_POST_WIDGET_DIR', plugin_dir_path( __FILE__ ) );
|
31 |
+
define( 'CUSTOM_POST_WIDGET_TEXTDOMAIN', 'custom-post-widget' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
|
33 |
+
/* Launch the plugin. */
|
34 |
+
add_action( 'plugins_loaded', 'custom_post_widget_plugin_init' );
|
35 |
|
36 |
+
/**
|
37 |
+
Initialize the plugin. This function loads the required files needed for the plugin
|
38 |
+
to run in the proper order and adds needed functions to the required hooks.
|
39 |
+
*/
|
40 |
+
function custom_post_widget_plugin_init() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
|
42 |
+
/* Load the translation of the plugin. */
|
43 |
+
load_plugin_textdomain( CUSTOM_POST_WIDGET_TEXTDOMAIN, false, 'custom-post-widget/languages' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
|
45 |
+
add_action( 'widgets_init', 'custom_post_widget_load_widgets' );
|
|
|
|
|
46 |
}
|
|
|
47 |
|
48 |
+
/**
|
49 |
+
Loads the widgets packaged with the plugin.
|
50 |
+
*/
|
51 |
+
function custom_post_widget_load_widgets() {
|
52 |
+
require_once( CUSTOM_POST_WIDGET_DIR . '/post-widget.php' );
|
53 |
+
register_widget( 'custom_post_widget' );
|
54 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
|
56 |
?>
|
languages/custom-post-widget-de_DE.mo
ADDED
Binary file
|
languages/custom-post-widget-de_DE.po
ADDED
@@ -0,0 +1,171 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
msgid ""
|
2 |
+
msgstr ""
|
3 |
+
"Project-Id-Version: \n"
|
4 |
+
"Report-Msgid-Bugs-To: \n"
|
5 |
+
"POT-Creation-Date: \n"
|
6 |
+
"PO-Revision-Date: \n"
|
7 |
+
"Last-Translator: \n"
|
8 |
+
"Language-Team: \n"
|
9 |
+
"MIME-Version: 1.0\n"
|
10 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
+
"Content-Transfer-Encoding: 8bit\n"
|
12 |
+
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
13 |
+
"X-Poedit-Language: \n"
|
14 |
+
"X-Poedit-Country: \n"
|
15 |
+
"X-Poedit-SourceCharset: utf-8\n"
|
16 |
+
"X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;_n_noop:1,2;_c,_nc:4c,1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2;\n"
|
17 |
+
"X-Poedit-Basepath: \n"
|
18 |
+
"X-Poedit-Bookmarks: \n"
|
19 |
+
"X-Poedit-SearchPath-0: .\n"
|
20 |
+
"X-Textdomain-Support: yes"
|
21 |
+
|
22 |
+
#: post-widget.php:8
|
23 |
+
#@ custom-post-widget
|
24 |
+
msgid "Displays custom post content in a widget"
|
25 |
+
msgstr "Zeigt benutzerdefinierte Inhalte in einem Widget an"
|
26 |
+
|
27 |
+
#: post-widget.php:9
|
28 |
+
#@ custom-post-widget
|
29 |
+
msgid "Content Block"
|
30 |
+
msgstr "Inhaltsblock"
|
31 |
+
|
32 |
+
#: post-widget.php:19
|
33 |
+
#@ custom-post-widget
|
34 |
+
msgid "Content Block to Display:"
|
35 |
+
msgstr "Anzuzeigender Inhaltsblock"
|
36 |
+
|
37 |
+
#: post-widget.php:31
|
38 |
+
#@ custom-post-widget
|
39 |
+
msgid "No content blocks available"
|
40 |
+
msgstr "Keine Inhaltsblöcke verfügbar"
|
41 |
+
|
42 |
+
#: post-widget.php:43
|
43 |
+
#@ custom-post-widget
|
44 |
+
msgid "Show Post Title"
|
45 |
+
msgstr "Beitragstitel anzeigen"
|
46 |
+
|
47 |
+
#: post-widget.php:62
|
48 |
+
#@ custom-post-widget
|
49 |
+
msgid "Find"
|
50 |
+
msgstr "Finden"
|
51 |
+
|
52 |
+
#: post-widget.php:94
|
53 |
+
#@ custom-post-widget
|
54 |
+
msgctxt "post type general name"
|
55 |
+
msgid "Content Blocks"
|
56 |
+
msgstr "Inhaltsblöcke"
|
57 |
+
|
58 |
+
#: post-widget.php:95
|
59 |
+
#@ custom-post-widget
|
60 |
+
msgctxt "post type singular name"
|
61 |
+
msgid "Content Block"
|
62 |
+
msgstr "Inhaltsblock"
|
63 |
+
|
64 |
+
#: post-widget.php:97
|
65 |
+
#@ custom-post-widget
|
66 |
+
msgctxt "block"
|
67 |
+
msgid "Add Content Block"
|
68 |
+
msgstr "Inhaltsblock erstellen"
|
69 |
+
|
70 |
+
#: post-widget.php:98
|
71 |
+
#@ custom-post-widget
|
72 |
+
msgid "Add New Content Block"
|
73 |
+
msgstr "Neuen Inhaltsblock erstellen"
|
74 |
+
|
75 |
+
#: post-widget.php:99
|
76 |
+
#@ custom-post-widget
|
77 |
+
msgid "Edit Content Block"
|
78 |
+
msgstr "Inhaltsblock bearbeiten"
|
79 |
+
|
80 |
+
#: post-widget.php:100
|
81 |
+
#@ custom-post-widget
|
82 |
+
msgid "New Content Block"
|
83 |
+
msgstr "Neuer Inhaltsblock"
|
84 |
+
|
85 |
+
#: post-widget.php:101
|
86 |
+
#@ custom-post-widget
|
87 |
+
msgid "View Content Block"
|
88 |
+
msgstr "Inhaltsblock ansehen"
|
89 |
+
|
90 |
+
#: post-widget.php:102
|
91 |
+
#@ custom-post-widget
|
92 |
+
msgid "Search Content Blocks"
|
93 |
+
msgstr "Inhaltsblöcke durchsuchen"
|
94 |
+
|
95 |
+
#: post-widget.php:103
|
96 |
+
#@ custom-post-widget
|
97 |
+
msgid "No Content Blocks Found"
|
98 |
+
msgstr "Keine Inhaltsblöcke gefunden"
|
99 |
+
|
100 |
+
#: post-widget.php:104
|
101 |
+
#@ custom-post-widget
|
102 |
+
msgid "No Content Blocks found in Trash"
|
103 |
+
msgstr "Keine Inhaltsblöcke im Papierkorb gefunden"
|
104 |
+
|
105 |
+
#: post-widget.php:129
|
106 |
+
#, php-format
|
107 |
+
#@ custom-post-widget
|
108 |
+
msgid "Content Block updated. <a href=\"%s\">View Content Block</a>"
|
109 |
+
msgstr "Inhaltsblock aktualisiert. <a href=\"%s\">Ansehen</a>"
|
110 |
+
|
111 |
+
#: post-widget.php:130
|
112 |
+
#@ custom-post-widget
|
113 |
+
msgid "Custom field updated."
|
114 |
+
msgstr "Benutzerdefiniertes Feld aktualisiert."
|
115 |
+
|
116 |
+
#: post-widget.php:131
|
117 |
+
#@ custom-post-widget
|
118 |
+
msgid "Custom field deleted."
|
119 |
+
msgstr "Benutzerdefiniertes Feld gelöscht."
|
120 |
+
|
121 |
+
#: post-widget.php:132
|
122 |
+
#@ custom-post-widget
|
123 |
+
msgid "Content Block updated."
|
124 |
+
msgstr "Inhaltsblock aktualisiert."
|
125 |
+
|
126 |
+
#: post-widget.php:133
|
127 |
+
#, php-format
|
128 |
+
#@ custom-post-widget
|
129 |
+
msgid "Content Block restored to revision from %s"
|
130 |
+
msgstr "Inhaltsblock wiederhergestellt als Revision vom %s"
|
131 |
+
|
132 |
+
#: post-widget.php:134
|
133 |
+
#, php-format
|
134 |
+
#@ custom-post-widget
|
135 |
+
msgid "Content Block published. <a href=\"%s\">View Content Block</a>"
|
136 |
+
msgstr "Inhaltsblock publiziert. <a href=\"%s\">Ansehen</a>"
|
137 |
+
|
138 |
+
#: post-widget.php:135
|
139 |
+
#@ custom-post-widget
|
140 |
+
msgid "Block saved."
|
141 |
+
msgstr "Inhaltsblock gespeichert."
|
142 |
+
|
143 |
+
#: post-widget.php:136
|
144 |
+
#, php-format
|
145 |
+
#@ custom-post-widget
|
146 |
+
msgid "Content Block submitted. <a target=\"_blank\" href=\"%s\">Preview Content Block</a>"
|
147 |
+
msgstr "Inhaltsblock gesendet. <a target=\"_blank\" href=\"%s\">Vorschau anzeigen</a>"
|
148 |
+
|
149 |
+
#: post-widget.php:137
|
150 |
+
#, php-format
|
151 |
+
#@ custom-post-widget
|
152 |
+
msgid "Content Block scheduled for: <strong>%1$s</strong>. <a target=\"_blank\" href=\"%2$s\">Preview block</a>"
|
153 |
+
msgstr "Inhaltsblock terminiert zum: <strong>%1$s</strong>. <a target=\"_blank\" href=\"%2$s\">Vorschau ansehen</a>"
|
154 |
+
|
155 |
+
#: post-widget.php:138
|
156 |
+
#@ custom-post-widget
|
157 |
+
msgid "M j, Y @ G:i"
|
158 |
+
msgstr "j. M Y @ H:M"
|
159 |
+
|
160 |
+
#: post-widget.php:139
|
161 |
+
#, php-format
|
162 |
+
#@ custom-post-widget
|
163 |
+
msgid "Content Block draft updated. <a target=\"_blank\" href=\"%s\">Preview Content Block</a>"
|
164 |
+
msgstr "Entwurf aktualisiert. <a target=\"_blank\" href=\"%s\">Vorschau ansehen</a>"
|
165 |
+
|
166 |
+
#: post-widget.php:96
|
167 |
+
#@ custom-post-widget
|
168 |
+
msgctxt "post type plural name"
|
169 |
+
msgid "Content Blocks"
|
170 |
+
msgstr "Inhaltsblöcke"
|
171 |
+
|
languages/custom-post-widget-nl_NL.mo
ADDED
Binary file
|
languages/custom-post-widget-nl_NL.po
ADDED
@@ -0,0 +1,170 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
msgid ""
|
2 |
+
msgstr ""
|
3 |
+
"Project-Id-Version: Custom Post Widget\n"
|
4 |
+
"Report-Msgid-Bugs-To: \n"
|
5 |
+
"POT-Creation-Date: \n"
|
6 |
+
"PO-Revision-Date: \n"
|
7 |
+
"Last-Translator: Johan van der Wijk <info@vanderwijk.com>\n"
|
8 |
+
"Language-Team: Johan van der Wijk <info@vanderwijk.com>\n"
|
9 |
+
"MIME-Version: 1.0\n"
|
10 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
+
"Content-Transfer-Encoding: 8bit\n"
|
12 |
+
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
13 |
+
"X-Poedit-Language: Dutch\n"
|
14 |
+
"X-Poedit-Country: NETHERLANDS\n"
|
15 |
+
"X-Poedit-SourceCharset: utf-8\n"
|
16 |
+
"X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;_n_noop:1,2;_c,_nc:4c,1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2\n"
|
17 |
+
"X-Poedit-Basepath: .\n"
|
18 |
+
"X-Textdomain-Support: yes\n"
|
19 |
+
"X-Poedit-SearchPath-0: .\n"
|
20 |
+
|
21 |
+
#@ custom-post-widget
|
22 |
+
#: post-widget.php:8
|
23 |
+
msgid "Displays custom post content in a widget"
|
24 |
+
msgstr "Toont een inhoudsblok in een widget"
|
25 |
+
|
26 |
+
#@ custom-post-widget
|
27 |
+
#: post-widget.php:9
|
28 |
+
msgid "Content Block"
|
29 |
+
msgstr "Inhoudsblok"
|
30 |
+
|
31 |
+
#@ custom-post-widget
|
32 |
+
#: post-widget.php:19
|
33 |
+
msgid "Content Block to Display:"
|
34 |
+
msgstr "Weer te geven inhoudsblok:"
|
35 |
+
|
36 |
+
#@ custom-post-widget
|
37 |
+
#: post-widget.php:31
|
38 |
+
msgid "No content blocks available"
|
39 |
+
msgstr "Geen inhoudsblokken beschikbaar"
|
40 |
+
|
41 |
+
#@ custom-post-widget
|
42 |
+
#: post-widget.php:43
|
43 |
+
msgid "Show Post Title"
|
44 |
+
msgstr "Toon de titel"
|
45 |
+
|
46 |
+
#@ custom-post-widget
|
47 |
+
#: post-widget.php:62
|
48 |
+
msgid "Find"
|
49 |
+
msgstr "Zoeken"
|
50 |
+
|
51 |
+
#@ custom-post-widget
|
52 |
+
#: post-widget.php:94
|
53 |
+
msgctxt "post type general name"
|
54 |
+
msgid "Content Blocks"
|
55 |
+
msgstr "Inhoudsblokken"
|
56 |
+
|
57 |
+
#@ custom-post-widget
|
58 |
+
#: post-widget.php:95
|
59 |
+
msgctxt "post type singular name"
|
60 |
+
msgid "Content Block"
|
61 |
+
msgstr "Inhoudsblok"
|
62 |
+
|
63 |
+
#@ custom-post-widget
|
64 |
+
#: post-widget.php:97
|
65 |
+
msgctxt "block"
|
66 |
+
msgid "Add Content Block"
|
67 |
+
msgstr "Nieuw Inhoudsblok"
|
68 |
+
|
69 |
+
#@ custom-post-widget
|
70 |
+
#: post-widget.php:98
|
71 |
+
msgid "Add New Content Block"
|
72 |
+
msgstr "Nieuw inhoudsblok toevoegen"
|
73 |
+
|
74 |
+
#@ custom-post-widget
|
75 |
+
#: post-widget.php:99
|
76 |
+
msgid "Edit Content Block"
|
77 |
+
msgstr "Inhoudsblok Bewerken"
|
78 |
+
|
79 |
+
#@ custom-post-widget
|
80 |
+
#: post-widget.php:100
|
81 |
+
msgid "New Content Block"
|
82 |
+
msgstr "Nieuw Inhoudsblok"
|
83 |
+
|
84 |
+
#@ custom-post-widget
|
85 |
+
#: post-widget.php:101
|
86 |
+
msgid "View Content Block"
|
87 |
+
msgstr "Inhoudsblok Bekijken"
|
88 |
+
|
89 |
+
#@ custom-post-widget
|
90 |
+
#: post-widget.php:102
|
91 |
+
msgid "Search Content Blocks"
|
92 |
+
msgstr "Inhoudsblokken zoeken"
|
93 |
+
|
94 |
+
#@ custom-post-widget
|
95 |
+
#: post-widget.php:103
|
96 |
+
msgid "No Content Blocks Found"
|
97 |
+
msgstr "Geen Inhoudsblokken"
|
98 |
+
|
99 |
+
#@ custom-post-widget
|
100 |
+
#: post-widget.php:104
|
101 |
+
msgid "No Content Blocks found in Trash"
|
102 |
+
msgstr "Geen Inhoudsblokken in de Prullenbak"
|
103 |
+
|
104 |
+
#@ custom-post-widget
|
105 |
+
#: post-widget.php:129
|
106 |
+
#, php-format
|
107 |
+
msgid "Content Block updated. <a href=\"%s\">View Content Block</a>"
|
108 |
+
msgstr "Inhoudsblok Bijgewerkt. <a href=\"%s\">Toon Inhoudsblok</a>"
|
109 |
+
|
110 |
+
#@ custom-post-widget
|
111 |
+
#: post-widget.php:130
|
112 |
+
msgid "Custom field updated."
|
113 |
+
msgstr "Custom field bijgewerkt."
|
114 |
+
|
115 |
+
#@ custom-post-widget
|
116 |
+
#: post-widget.php:131
|
117 |
+
msgid "Custom field deleted."
|
118 |
+
msgstr "Custom field verwijderd."
|
119 |
+
|
120 |
+
#@ custom-post-widget
|
121 |
+
#: post-widget.php:132
|
122 |
+
msgid "Content Block updated."
|
123 |
+
msgstr "Inhoudsblok bijgewerkt."
|
124 |
+
|
125 |
+
#@ custom-post-widget
|
126 |
+
#: post-widget.php:133
|
127 |
+
#, php-format
|
128 |
+
msgid "Content Block restored to revision from %s"
|
129 |
+
msgstr "Inhoudsblok teruggezet naar revisie %s"
|
130 |
+
|
131 |
+
#@ custom-post-widget
|
132 |
+
#: post-widget.php:134
|
133 |
+
#, php-format
|
134 |
+
msgid "Content Block published. <a href=\"%s\">View Content Block</a>"
|
135 |
+
msgstr "Inhoudsblok gepublicieerd. <a href=\"%s\">Bekijk Inhoudsblok</a>"
|
136 |
+
|
137 |
+
#@ custom-post-widget
|
138 |
+
#: post-widget.php:135
|
139 |
+
msgid "Block saved."
|
140 |
+
msgstr "Inhoudsblok Opgeslagen."
|
141 |
+
|
142 |
+
#@ custom-post-widget
|
143 |
+
#: post-widget.php:136
|
144 |
+
#, php-format
|
145 |
+
msgid "Content Block submitted. <a target=\"_blank\" href=\"%s\">Preview Content Block</a>"
|
146 |
+
msgstr "Inhoudsblok Bewaard. <a target=\"_blank\" href=\"%s\">Toon Preview</a>"
|
147 |
+
|
148 |
+
#@ custom-post-widget
|
149 |
+
#: post-widget.php:137
|
150 |
+
#, php-format
|
151 |
+
msgid "Content Block scheduled for: <strong>%1$s</strong>. <a target=\"_blank\" href=\"%2$s\">Preview block</a>"
|
152 |
+
msgstr "Inhoudsblok zal worden gepubliceerd op: <strong>%1$s</strong>. <a target=\"_blank\" href=\"%2$s\">Toon preview</a>"
|
153 |
+
|
154 |
+
#@ custom-post-widget
|
155 |
+
#: post-widget.php:138
|
156 |
+
msgid "M j, Y @ G:i"
|
157 |
+
msgstr "j. M Y @ H:M"
|
158 |
+
|
159 |
+
#@ custom-post-widget
|
160 |
+
#: post-widget.php:139
|
161 |
+
#, php-format
|
162 |
+
msgid "Content Block draft updated. <a target=\"_blank\" href=\"%s\">Preview Content Block</a>"
|
163 |
+
msgstr "Inhoudsblok draft bijgewerkt. <a target=\"_blank\" href=\"%s\">Toon preview</a>"
|
164 |
+
|
165 |
+
#@ custom-post-widget
|
166 |
+
#: post-widget.php:96
|
167 |
+
msgctxt "post type plural name"
|
168 |
+
msgid "Content Blocks"
|
169 |
+
msgstr "Inhoudsblokken"
|
170 |
+
|
languages/custom-post-widget-xx_XX.pot
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
MIME-Version: 1.0\nContent-Type: text/plain; charset=UTF-8\nContent-Transfer-Encoding: 8bit
|
post-widget.php
ADDED
@@ -0,0 +1,142 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// First create the widget for the admin panel
|
4 |
+
class custom_post_widget extends WP_Widget
|
5 |
+
{
|
6 |
+
function custom_post_widget()
|
7 |
+
{
|
8 |
+
$widget_ops = array('description' => __('Displays custom post content in a widget', CUSTOM_POST_WIDGET_TEXTDOMAIN));
|
9 |
+
$this->WP_Widget('custom_post_widget', __('Content Block', CUSTOM_POST_WIDGET_TEXTDOMAIN), $widget_ops);
|
10 |
+
}
|
11 |
+
|
12 |
+
function form($instance)
|
13 |
+
{
|
14 |
+
$custom_post_id = esc_attr($instance['custom_post_id']);
|
15 |
+
$show_custom_post_title = isset($instance['show_custom_post_title ']) ? $instance['show_custom_post_title '] : true;
|
16 |
+
|
17 |
+
?>
|
18 |
+
<p>
|
19 |
+
<label for="<?php echo $this->get_field_id('custom_post_id'); ?>"> <?php echo __('Content Block to Display:', CUSTOM_POST_WIDGET_TEXTDOMAIN) ?>
|
20 |
+
<select class="widefat" id="<?php echo $this->get_field_id('custom_post_id'); ?>" name="<?php echo $this->get_field_name('custom_post_id'); ?>">
|
21 |
+
<?php query_posts('post_type=content_block&orderby=ID&order=ASC&showposts=-1');
|
22 |
+
if ( have_posts() ) : while ( have_posts() ) : the_post();
|
23 |
+
$currentID = get_the_ID();
|
24 |
+
if($currentID == $custom_post_id)
|
25 |
+
$extra = 'selected' and
|
26 |
+
$widgetExtraTitle = get_the_title();
|
27 |
+
else
|
28 |
+
$extra = '';
|
29 |
+
echo '<option value="'.$currentID.'" '.$extra.'>'.get_the_title().'</option>';
|
30 |
+
endwhile; else:
|
31 |
+
echo '<option value="empty">' . __('No content blocks available', CUSTOM_POST_WIDGET_TEXTDOMAIN) . '</option>';
|
32 |
+
endif;
|
33 |
+
?>
|
34 |
+
</select>
|
35 |
+
</label>
|
36 |
+
</p>
|
37 |
+
<?php ?>
|
38 |
+
<input type="hidden" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php echo $widgetExtraTitle; ?>" />
|
39 |
+
<?php wp_reset_query(); ?>
|
40 |
+
<p>
|
41 |
+
<input class="checkbox" type="checkbox" <?php checked( (bool) $instance['show_custom_post_title'], true ); ?> id="<?php echo $this->get_field_id( 'show_custom_post_title' ); ?>" name="<?php echo $this->get_field_name( 'show_custom_post_title' ); ?>" />
|
42 |
+
<label for="<?php echo $this->get_field_id( 'show_custom_post_title' ); ?>"><?php echo __('Show Post Title', CUSTOM_POST_WIDGET_TEXTDOMAIN) ?></label>
|
43 |
+
</p>
|
44 |
+
|
45 |
+
<?php
|
46 |
+
}
|
47 |
+
|
48 |
+
function update($new_instance, $old_instance)
|
49 |
+
{
|
50 |
+
$instance = $old_instance;
|
51 |
+
$instance['custom_post_id'] = strip_tags($new_instance['custom_post_id']);
|
52 |
+
$instance['show_custom_post_title'] = $new_instance['show_custom_post_title'];
|
53 |
+
|
54 |
+
return $instance;
|
55 |
+
}
|
56 |
+
|
57 |
+
function widget($args, $instance)
|
58 |
+
{
|
59 |
+
extract($args);
|
60 |
+
|
61 |
+
$custom_post_id = ( $instance['custom_post_id'] != '' ) ? esc_attr($instance['custom_post_id']) : __('Find', CUSTOM_POST_WIDGET_TEXTDOMAIN);
|
62 |
+
|
63 |
+
/* Our variables from the widget settings. */
|
64 |
+
$show_custom_post_title = isset( $instance['show_custom_post_title'] ) ? $instance['show_custom_post_title'] : false;
|
65 |
+
|
66 |
+
/* Before widget (defined by themes). */
|
67 |
+
echo $before_widget;
|
68 |
+
|
69 |
+
// Output the query to find the custom post
|
70 |
+
query_posts( 'post_type=content_block&p=' . $custom_post_id );
|
71 |
+
while (have_posts()) : the_post();
|
72 |
+
|
73 |
+
if ( $show_custom_post_title )
|
74 |
+
echo the_title($before_title, $after_title); // This is the line that displays the title
|
75 |
+
echo the_content();
|
76 |
+
endwhile;
|
77 |
+
wp_reset_query();
|
78 |
+
|
79 |
+
// Output $after_widget
|
80 |
+
echo $after_widget;
|
81 |
+
}
|
82 |
+
}
|
83 |
+
|
84 |
+
// Create the Content Block custom post type
|
85 |
+
|
86 |
+
add_action('init', 'my_content_block_post_type_init');
|
87 |
+
|
88 |
+
function my_content_block_post_type_init()
|
89 |
+
{
|
90 |
+
$labels = array(
|
91 |
+
'name' => _x('Content Blocks', 'post type general name', CUSTOM_POST_WIDGET_TEXTDOMAIN),
|
92 |
+
'singular_name' => _x('Content Block', 'post type singular name', CUSTOM_POST_WIDGET_TEXTDOMAIN),
|
93 |
+
'plural_name' => _x('Content Blocks', 'post type plural name', CUSTOM_POST_WIDGET_TEXTDOMAIN),
|
94 |
+
'add_new' => _x('Add Content Block', 'block', CUSTOM_POST_WIDGET_TEXTDOMAIN),
|
95 |
+
'add_new_item' => __('Add New Content Block', CUSTOM_POST_WIDGET_TEXTDOMAIN),
|
96 |
+
'edit_item' => __('Edit Content Block', CUSTOM_POST_WIDGET_TEXTDOMAIN),
|
97 |
+
'new_item' => __('New Content Block', CUSTOM_POST_WIDGET_TEXTDOMAIN),
|
98 |
+
'view_item' => __('View Content Block', CUSTOM_POST_WIDGET_TEXTDOMAIN),
|
99 |
+
'search_items' => __('Search Content Blocks', CUSTOM_POST_WIDGET_TEXTDOMAIN),
|
100 |
+
'not_found' => __('No Content Blocks Found', CUSTOM_POST_WIDGET_TEXTDOMAIN),
|
101 |
+
'not_found_in_trash' => __('No Content Blocks found in Trash', CUSTOM_POST_WIDGET_TEXTDOMAIN),
|
102 |
+
'parent_item_colon' => ''
|
103 |
+
);
|
104 |
+
$options = array(
|
105 |
+
'labels' => $labels,
|
106 |
+
'public' => false,
|
107 |
+
'publicly_queryable' => false,
|
108 |
+
'exclude_from_search' => true,
|
109 |
+
'show_ui' => true,
|
110 |
+
'query_var' => true,
|
111 |
+
'rewrite' => true,
|
112 |
+
'capability_type' => 'post',
|
113 |
+
'hierarchical' => false,
|
114 |
+
'menu_position' => null,
|
115 |
+
'supports' => array('title','editor','revisions','thumbnail')
|
116 |
+
);
|
117 |
+
register_post_type('content_block',$options);
|
118 |
+
}
|
119 |
+
|
120 |
+
add_filter('post_updated_messages', 'content_block_messages');
|
121 |
+
|
122 |
+
function content_block_messages( $messages ) {
|
123 |
+
|
124 |
+
$messages['content_block'] = array(
|
125 |
+
0 => '',
|
126 |
+
1 => sprintf( __('Content Block updated. <a href="%s">View Content Block</a>', CUSTOM_POST_WIDGET_TEXTDOMAIN), esc_url( get_permalink($post_ID) ) ),
|
127 |
+
2 => __('Custom field updated.', CUSTOM_POST_WIDGET_TEXTDOMAIN),
|
128 |
+
3 => __('Custom field deleted.', CUSTOM_POST_WIDGET_TEXTDOMAIN),
|
129 |
+
4 => __('Content Block updated.', CUSTOM_POST_WIDGET_TEXTDOMAIN),
|
130 |
+
5 => isset($_GET['revision']) ? sprintf( __('Content Block restored to revision from %s', CUSTOM_POST_WIDGET_TEXTDOMAIN), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
|
131 |
+
6 => sprintf( __('Content Block published. <a href="%s">View Content Block</a>', CUSTOM_POST_WIDGET_TEXTDOMAIN), esc_url( get_permalink($post_ID) ) ),
|
132 |
+
7 => __('Block saved.', CUSTOM_POST_WIDGET_TEXTDOMAIN),
|
133 |
+
8 => sprintf( __('Content Block submitted. <a target="_blank" href="%s">Preview Content Block</a>', CUSTOM_POST_WIDGET_TEXTDOMAIN), esc_url( add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ) ),
|
134 |
+
9 => sprintf( __('Content Block scheduled for: <strong>%1$s</strong>. <a target="_blank" href="%2$s">Preview block</a>', CUSTOM_POST_WIDGET_TEXTDOMAIN),
|
135 |
+
date_i18n( __( 'M j, Y @ G:i' , CUSTOM_POST_WIDGET_TEXTDOMAIN), strtotime( $post->post_date ) ), esc_url( get_permalink($post_ID) ) ),
|
136 |
+
10 => sprintf( __('Content Block draft updated. <a target="_blank" href="%s">Preview Content Block</a>', CUSTOM_POST_WIDGET_TEXTDOMAIN), esc_url( add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ) ),
|
137 |
+
);
|
138 |
+
|
139 |
+
return $messages;
|
140 |
+
}
|
141 |
+
|
142 |
+
?>
|
readme.txt
CHANGED
@@ -4,8 +4,8 @@ Author URI: http://www.vanderwijk.com/
|
|
4 |
Donate link: http://www.vanderwijk.com/wordpress/support/
|
5 |
Tags: custom-post, widget, sidebar
|
6 |
Requires at least: 2.9.2
|
7 |
-
Tested up to: 3.
|
8 |
-
Stable tag: 1.
|
9 |
|
10 |
This plugin enables you to display the content of a custom post type called Content Block in a sidebar widget.
|
11 |
|
@@ -69,9 +69,11 @@ The widget title now uses $before_title and $after_title to generate the appropr
|
|
69 |
= 1.3 =
|
70 |
Now the title of the content block is displayed in the admin interface to make it easy to manage the widgets.
|
71 |
|
72 |
-
|
|
|
73 |
|
74 |
-
= 1.1.1 =
|
75 |
-
Now supports more than 10 custom posts in the select box. Note that after upgrading you might have to save the widget state before the correct posts are being displayed.
|
76 |
|
|
|
77 |
|
|
|
|
4 |
Donate link: http://www.vanderwijk.com/wordpress/support/
|
5 |
Tags: custom-post, widget, sidebar
|
6 |
Requires at least: 2.9.2
|
7 |
+
Tested up to: 3.1
|
8 |
+
Stable tag: 1.4
|
9 |
|
10 |
This plugin enables you to display the content of a custom post type called Content Block in a sidebar widget.
|
11 |
|
69 |
= 1.3 =
|
70 |
Now the title of the content block is displayed in the admin interface to make it easy to manage the widgets.
|
71 |
|
72 |
+
= 1.4 =
|
73 |
+
The plugin has been translated into Dutch and German. Hat tip: Caspar Hübinger - glueckpress.com
|
74 |
|
|
|
|
|
75 |
|
76 |
+
== Upgrade Notice ==
|
77 |
|
78 |
+
= 1.1.1 =
|
79 |
+
Now supports more than 10 custom posts in the select box. Note that after upgrading you might have to save the widget state before the correct posts are being displayed.
|
screenshot-1.png
CHANGED
Binary file
|
screenshot-2.png
CHANGED
Binary file
|