Version Description
- Initial release.
Download this release
Release Info
Developer | tschutter |
Plugin | Column Shortcodes |
Version | 0.1 |
Comparing to | |
See all releases |
Version 0.1
- assets/css/admin.css +49 -0
- assets/css/shortcodes.css +94 -0
- assets/images/columns.png +0 -0
- assets/images/shortcode.png +0 -0
- assets/js/admin.js +27 -0
- column-shortcodes.php +324 -0
- languages/column-shortcodes-nl_NL.mo +0 -0
- languages/column-shortcodes-nl_NL.po +65 -0
- languages/column-shortcodes.po +65 -0
- readme.txt +116 -0
- screenshot-1.png +0 -0
- screenshot-2.png +0 -0
- screenshot-3.png +0 -0
assets/css/admin.css
ADDED
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#cpsh {}
|
2 |
+
|
3 |
+
/* =Popup
|
4 |
+
-------------------------------------------------------------- */
|
5 |
+
#cpsh {
|
6 |
+
margin-top: 13px;
|
7 |
+
width: 100%;
|
8 |
+
}
|
9 |
+
#cpsh .cpsh-title {
|
10 |
+
display: block;
|
11 |
+
height: 20px;
|
12 |
+
line-height: 20px;
|
13 |
+
width: 224px;
|
14 |
+
margin: 0 0 6px;
|
15 |
+
padding: 0;
|
16 |
+
color: #666;
|
17 |
+
font-size: 13px;
|
18 |
+
}
|
19 |
+
#cpsh #cpsh-generator-header {
|
20 |
+
border: 1px dashed #CCCCCC;
|
21 |
+
padding: 20px;
|
22 |
+
}
|
23 |
+
#cpsh .columns {
|
24 |
+
display: block;
|
25 |
+
height: 20px;
|
26 |
+
line-height: 20px;
|
27 |
+
padding-left: 94px;
|
28 |
+
width: 130px;
|
29 |
+
text-decoration: none;
|
30 |
+
background: transparent url(../images/columns.png) no-repeat 0 6px;
|
31 |
+
}
|
32 |
+
#cpsh .cp-one_half { background-position: 0 6px; }
|
33 |
+
#cpsh .cp-one_half_last { background-position: 0 -14px; }
|
34 |
+
#cpsh .cp-one_third { background-position: 0 -34px; }
|
35 |
+
#cpsh .cp-one_third_last { background-position: 0 -54px; }
|
36 |
+
#cpsh .cp-two_third { background-position: 0 -74px; }
|
37 |
+
#cpsh .cp-two_third_last { background-position: 0 -94px; }
|
38 |
+
#cpsh .cp-one_fourth { background-position: 0 -114px; }
|
39 |
+
#cpsh .cp-one_fourth_last { background-position: 0 -134px; }
|
40 |
+
#cpsh .cp-three_fourth { background-position: 0 -154px; }
|
41 |
+
#cpsh .cp-three_fourth_last { background-position: 0 -174px; }
|
42 |
+
#cpsh .cp-one_fifth { background-position: 0 -194px; }
|
43 |
+
#cpsh .cp-one_fifth_last { background-position: 0 -214px; }
|
44 |
+
#cpsh .cp-two_fifth { background-position: 0 -234px; }
|
45 |
+
#cpsh .cp-two_fifth_last { background-position: 0 -254px; }
|
46 |
+
#cpsh .cp-three_fifth { background-position: 0 -274px; }
|
47 |
+
#cpsh .cp-three_fifth_last { background-position: 0 -294px; }
|
48 |
+
#cpsh .cp-one_sixth { background-position: 0 -314px; }
|
49 |
+
#cpsh .cp-one_sixth_last { background-position: 0 -334px; }
|
assets/css/shortcodes.css
ADDED
@@ -0,0 +1,94 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/* =General CSS
|
2 |
+
-------------------------------------------------------------- */
|
3 |
+
.one_half,
|
4 |
+
.one_third,
|
5 |
+
.two_third,
|
6 |
+
.one_fourth,
|
7 |
+
.three_fourth,
|
8 |
+
.one_fifth,
|
9 |
+
.two_fifth,
|
10 |
+
.three_fifth,
|
11 |
+
.one_sixth {
|
12 |
+
float: left;
|
13 |
+
}
|
14 |
+
.clear_column {
|
15 |
+
clear:both;
|
16 |
+
display:block;
|
17 |
+
font-size:0; height:0;
|
18 |
+
line-height:0; width:100%;
|
19 |
+
overflow: hidden;
|
20 |
+
}
|
21 |
+
|
22 |
+
/* =Shortcodes Templates
|
23 |
+
-------------------------------------------------------------- */
|
24 |
+
|
25 |
+
/* =Default Template (no margin)
|
26 |
+
-------------------------------------------------------------- */
|
27 |
+
.one_half {
|
28 |
+
width: 50%;
|
29 |
+
}
|
30 |
+
.one_third {
|
31 |
+
width: 33.3%;
|
32 |
+
}
|
33 |
+
.two_third {
|
34 |
+
width: 66.6%;
|
35 |
+
}
|
36 |
+
.one_fourth {
|
37 |
+
width: 25%;
|
38 |
+
}
|
39 |
+
.three_fourth {
|
40 |
+
width: 75%;
|
41 |
+
}
|
42 |
+
.one_fifth {
|
43 |
+
width: 20%;
|
44 |
+
}
|
45 |
+
.two_fifth {
|
46 |
+
width: 40%;
|
47 |
+
}
|
48 |
+
.three_fifth {
|
49 |
+
width: 60%;
|
50 |
+
}
|
51 |
+
.one_sixth {
|
52 |
+
width: 16.6%;
|
53 |
+
}
|
54 |
+
|
55 |
+
/* =Small Margins Template
|
56 |
+
-------------------------------------------------------------- */
|
57 |
+
/*
|
58 |
+
.one_half {
|
59 |
+
width: 48%;
|
60 |
+
margin-right: 2%;
|
61 |
+
}
|
62 |
+
.one_third {
|
63 |
+
width: 32%;
|
64 |
+
margin-right: 1.3%;
|
65 |
+
}
|
66 |
+
.two_third {
|
67 |
+
width: 64%;
|
68 |
+
margin-right: 2.6%;
|
69 |
+
}
|
70 |
+
.one_fourth {
|
71 |
+
width: 24%;
|
72 |
+
margin-right: 1%;
|
73 |
+
}
|
74 |
+
.three_fourth {
|
75 |
+
width: 72%;
|
76 |
+
margin-right: 3%;
|
77 |
+
}
|
78 |
+
.one_fifth {
|
79 |
+
width: 19%;
|
80 |
+
margin-right: 1%;
|
81 |
+
}
|
82 |
+
.two_fifth {
|
83 |
+
width: 38%;
|
84 |
+
margin-right: 2%;
|
85 |
+
}
|
86 |
+
.three_fifth {
|
87 |
+
width: 57%;
|
88 |
+
margin-right: 3%;
|
89 |
+
}
|
90 |
+
.one_sixth {
|
91 |
+
width: 16%;
|
92 |
+
margin-right: 0.6%;
|
93 |
+
}
|
94 |
+
*/
|
assets/images/columns.png
ADDED
Binary file
|
assets/images/shortcode.png
ADDED
Binary file
|
assets/js/admin.js
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
(function($) {
|
2 |
+
|
3 |
+
$(document).ready(function()
|
4 |
+
{
|
5 |
+
codepressShortcodes();
|
6 |
+
});
|
7 |
+
|
8 |
+
/**
|
9 |
+
* description
|
10 |
+
*
|
11 |
+
*/
|
12 |
+
function codepressShortcodes()
|
13 |
+
{
|
14 |
+
// Insert shortcode
|
15 |
+
$('#cpsh .insert-shortcode').live('click', function(event) {
|
16 |
+
|
17 |
+
var shortcode = $(this).attr('rel');
|
18 |
+
|
19 |
+
window.send_to_editor(shortcode);
|
20 |
+
|
21 |
+
// Prevent default action
|
22 |
+
event.preventDefault();
|
23 |
+
return false;
|
24 |
+
});
|
25 |
+
}
|
26 |
+
|
27 |
+
})(jQuery);
|
column-shortcodes.php
ADDED
@@ -0,0 +1,324 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Plugin Name: Column Shortcodes
|
4 |
+
Version: 0.1
|
5 |
+
Description: Adds shortcodes to easily create columns in your posts or pages
|
6 |
+
Author: Codepress
|
7 |
+
Author URI: http://www.codepress.nl
|
8 |
+
Plugin URI: http://www.codepress.nl/plugins/
|
9 |
+
Text Domain: column-shortcodes
|
10 |
+
Domain Path: /languages
|
11 |
+
License: GPLv2
|
12 |
+
|
13 |
+
Copyright 2011 Codepress info@codepress.nl
|
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 published by
|
17 |
+
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 |
+
define( 'CPSH_VERSION', '0.1' );
|
30 |
+
define( 'CPSH_URL', plugins_url('', __FILE__) );
|
31 |
+
define( 'CPSH_TEXTDOMAIN', 'column-shortcodes' );
|
32 |
+
|
33 |
+
// Long posts should require a higher limit, see http://core.trac.wordpress.org/ticket/8553
|
34 |
+
@ini_set('pcre.backtrack_limit', 500000);
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Column Shortcodes
|
38 |
+
*
|
39 |
+
* @since 0.1
|
40 |
+
*
|
41 |
+
*/
|
42 |
+
class Codepress_Column_Shortcodes
|
43 |
+
{
|
44 |
+
/**
|
45 |
+
* Constructor
|
46 |
+
*
|
47 |
+
* @since 0.1
|
48 |
+
*/
|
49 |
+
function __construct()
|
50 |
+
{
|
51 |
+
add_action( 'wp_loaded', array( $this, 'init') );
|
52 |
+
}
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Initialize plugin.
|
56 |
+
*
|
57 |
+
* @since 0.1
|
58 |
+
*/
|
59 |
+
public function init()
|
60 |
+
{
|
61 |
+
$this->add_shortcodes();
|
62 |
+
|
63 |
+
add_action('admin_init', array( $this, 'add_editor_buttons' ) );
|
64 |
+
add_action( 'admin_footer', array( $this, 'popup' ) );
|
65 |
+
|
66 |
+
// styling & scripts
|
67 |
+
add_action( 'admin_print_styles', array( $this, 'admin_styles') );
|
68 |
+
add_action( 'admin_print_scripts', array( $this, 'admin_scripts') );
|
69 |
+
add_action( 'wp_enqueue_scripts', array( $this, 'frontend_styles') );
|
70 |
+
|
71 |
+
// translations
|
72 |
+
load_plugin_textdomain( CPSH_TEXTDOMAIN, false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
|
73 |
+
}
|
74 |
+
|
75 |
+
/**
|
76 |
+
* Register admin css
|
77 |
+
*
|
78 |
+
* @since 0.1
|
79 |
+
*/
|
80 |
+
public function admin_styles()
|
81 |
+
{
|
82 |
+
wp_enqueue_style( 'cpsh-admin', CPSH_URL.'/assets/css/admin.css', array(), CPSH_VERSION, 'all' );
|
83 |
+
}
|
84 |
+
|
85 |
+
/**
|
86 |
+
* Register admin scripts
|
87 |
+
*
|
88 |
+
* @since 0.1
|
89 |
+
*/
|
90 |
+
public function admin_scripts()
|
91 |
+
{
|
92 |
+
wp_enqueue_script( 'cpsh-admin', CPSH_URL.'/assets/js/admin.js', array('jquery'), CPSH_VERSION );
|
93 |
+
}
|
94 |
+
|
95 |
+
/**
|
96 |
+
* Register frontend styles
|
97 |
+
*
|
98 |
+
* @since 1.0
|
99 |
+
*/
|
100 |
+
public function frontend_styles()
|
101 |
+
{
|
102 |
+
wp_enqueue_style( 'cpsh-shortcodes', CPSH_URL.'/assets/css/shortcodes.css', array(), CPSH_VERSION, 'all' );
|
103 |
+
}
|
104 |
+
|
105 |
+
/**
|
106 |
+
* Add shortcodes
|
107 |
+
*
|
108 |
+
* @since 0.1
|
109 |
+
*/
|
110 |
+
function add_shortcodes()
|
111 |
+
{
|
112 |
+
foreach ( $this->get_shortcodes() as $shortcode ) {
|
113 |
+
add_shortcode($shortcode['name'], array( $this, 'columns') );
|
114 |
+
}
|
115 |
+
}
|
116 |
+
|
117 |
+
/**
|
118 |
+
* Insert Markup
|
119 |
+
*
|
120 |
+
* @since 0.1
|
121 |
+
*/
|
122 |
+
function columns($atts, $content = null, $name='')
|
123 |
+
{
|
124 |
+
extract(shortcode_atts(array(
|
125 |
+
"id" => '',
|
126 |
+
"class" => ''
|
127 |
+
), $atts));
|
128 |
+
|
129 |
+
$content = $this->content_helper($content);
|
130 |
+
|
131 |
+
$id = ($id <> '') ? " id='" . esc_attr( $id ) . "'" : '';
|
132 |
+
$class = ($class <> '') ? esc_attr( ' ' . $class ) : '';
|
133 |
+
|
134 |
+
$pos = strpos($name,'_last');
|
135 |
+
|
136 |
+
if($pos !== false)
|
137 |
+
$name = str_replace('_last',' last_column',$name);
|
138 |
+
|
139 |
+
$output = "<div{$id} class='{$name}{$class}'>{$content}</div>";
|
140 |
+
|
141 |
+
if($pos !== false)
|
142 |
+
$output .= "<div class='clear_column'></div>";
|
143 |
+
|
144 |
+
return $output;
|
145 |
+
}
|
146 |
+
|
147 |
+
/**
|
148 |
+
* Add buttons to TimyMCE
|
149 |
+
*
|
150 |
+
* @since 0.1
|
151 |
+
*/
|
152 |
+
function add_editor_buttons()
|
153 |
+
{
|
154 |
+
if ( current_user_can( 'edit_posts' ) && current_user_can( 'edit_pages' ) ) {
|
155 |
+
if ( in_array(basename($_SERVER['PHP_SELF']), array('post-new.php', 'page-new.php', 'post.php', 'page.php') ) ) {
|
156 |
+
|
157 |
+
// add html buttons
|
158 |
+
add_action( 'admin_head', array( $this, 'add_html_buttons' ) );
|
159 |
+
|
160 |
+
// add shortcode button
|
161 |
+
add_action( 'media_buttons', array( $this, 'add_shortcode_button' ), 100 );
|
162 |
+
}
|
163 |
+
}
|
164 |
+
}
|
165 |
+
|
166 |
+
/**
|
167 |
+
* Add shortcode button to TimyMCE
|
168 |
+
*
|
169 |
+
* @since 0.1
|
170 |
+
*/
|
171 |
+
function add_shortcode_button( $page = null, $target = null )
|
172 |
+
{
|
173 |
+
echo "
|
174 |
+
<a href='#TB_inline?width=640&height=600&inlineId=cpsh-wrap' class='thickbox' title='" . __( 'Select shortcode', CPSH_TEXTDOMAIN ) . "' data-page='{$page}' data-target='{$target}'>
|
175 |
+
<img src='" . CPSH_URL . "/assets/images/shortcode.png' alt='' />
|
176 |
+
</a>
|
177 |
+
";
|
178 |
+
}
|
179 |
+
|
180 |
+
/**
|
181 |
+
* TB window Popup
|
182 |
+
*
|
183 |
+
* @since 0.1
|
184 |
+
*/
|
185 |
+
function popup()
|
186 |
+
{
|
187 |
+
$buttons = $this->get_shortcodes();
|
188 |
+
|
189 |
+
// buttons
|
190 |
+
$select = '';
|
191 |
+
foreach ( $buttons as $button ) {
|
192 |
+
|
193 |
+
$open_tag = str_replace('\n', '', $button['options']['open_tag']);
|
194 |
+
$close_tag = str_replace('\n', '', $button['options']['close_tag']);
|
195 |
+
|
196 |
+
$select .= "
|
197 |
+
<a href='javascript:;' rel='{$open_tag}{$close_tag}' class='cp-{$button['name']} columns insert-shortcode'>
|
198 |
+
{$button['options']['display_name']}
|
199 |
+
</a>";
|
200 |
+
}
|
201 |
+
|
202 |
+
// popup frame
|
203 |
+
$popup = "
|
204 |
+
<div id='cpsh-wrap' style='display:none'>
|
205 |
+
<div id='cpsh'>
|
206 |
+
<div id='cpsh-generator-shell'>
|
207 |
+
<div id='cpsh-generator-header'>
|
208 |
+
<h2 class='cpsh-title'>" . __('Column shortcodes', CPSH_TEXTDOMAIN) . "</h2>
|
209 |
+
{$select}
|
210 |
+
</div>
|
211 |
+
<div id='cpsh-settings'></div>
|
212 |
+
</div>
|
213 |
+
</div>
|
214 |
+
</div>
|
215 |
+
";
|
216 |
+
|
217 |
+
echo $popup;
|
218 |
+
}
|
219 |
+
|
220 |
+
/**
|
221 |
+
* get shortcodes
|
222 |
+
*
|
223 |
+
* @since 0.1
|
224 |
+
*/
|
225 |
+
function get_shortcodes()
|
226 |
+
{
|
227 |
+
$shortcodes = array();
|
228 |
+
|
229 |
+
// define column shortcodes
|
230 |
+
$column_shortcodes = array(
|
231 |
+
'one_half' => array ('display_name' => __('one half', CPSH_TEXTDOMAIN) ),
|
232 |
+
'one_third' => array ('display_name' => __('one third', CPSH_TEXTDOMAIN) ),
|
233 |
+
'one_fourth' => array ('display_name' => __('one fourth', CPSH_TEXTDOMAIN) ),
|
234 |
+
'two_third' => array ('display_name' => __('two third', CPSH_TEXTDOMAIN) ),
|
235 |
+
'three_fourth' => array ('display_name' => __('three fourth', CPSH_TEXTDOMAIN) ),
|
236 |
+
'one_fifth' => array ('display_name' => __('one fifth', CPSH_TEXTDOMAIN) ),
|
237 |
+
'two_fifth' => array ('display_name' => __('two fifth', CPSH_TEXTDOMAIN) ),
|
238 |
+
'three_fifth' => array ('display_name' => __('three fifth', CPSH_TEXTDOMAIN) ),
|
239 |
+
'one_sixth' => array ('display_name' => __('one sixth', CPSH_TEXTDOMAIN) )
|
240 |
+
);
|
241 |
+
|
242 |
+
foreach ( $column_shortcodes as $shortcode => $options ) {
|
243 |
+
$shortcodes[] = array(
|
244 |
+
'name' => $shortcode,
|
245 |
+
'options' => array(
|
246 |
+
'display_name' => $options['display_name'],
|
247 |
+
'open_tag' => '\n'."[{$shortcode}]",
|
248 |
+
'close_tag' => "[/{$shortcode}]".'\n',
|
249 |
+
'key' => ''
|
250 |
+
)
|
251 |
+
);
|
252 |
+
$shortcodes[] = array(
|
253 |
+
'name' => "{$shortcode}_last",
|
254 |
+
'options' => array(
|
255 |
+
'display_name' => $options['display_name'] . ' (' . __('last', CPSH_TEXTDOMAIN) . ')',
|
256 |
+
'open_tag' => '\n'."[{$shortcode}_last]",
|
257 |
+
'close_tag' => "[/{$shortcode}_last]".'\n',
|
258 |
+
'key' => ''
|
259 |
+
)
|
260 |
+
);
|
261 |
+
}
|
262 |
+
|
263 |
+
return $shortcodes;
|
264 |
+
}
|
265 |
+
|
266 |
+
/**
|
267 |
+
* Add buttons to TimyMCE HTML tab
|
268 |
+
*
|
269 |
+
* @since 0.1
|
270 |
+
*/
|
271 |
+
function add_html_buttons()
|
272 |
+
{
|
273 |
+
wp_print_scripts( 'quicktags' );
|
274 |
+
|
275 |
+
$shortcodes = $this->get_shortcodes();
|
276 |
+
|
277 |
+
// output script
|
278 |
+
$script = '';
|
279 |
+
foreach ( $shortcodes as $shortcode ) {
|
280 |
+
$options = $shortcode['options'];
|
281 |
+
|
282 |
+
$script .= "edButtons[edButtons.length] = new edButton('ed_{$shortcode['name']}'
|
283 |
+
,'{$shortcode['name']}'
|
284 |
+
,'{$options['open_tag']}'
|
285 |
+
,'{$options['close_tag']}'
|
286 |
+
,'{$options['key']}'
|
287 |
+
); \n";
|
288 |
+
}
|
289 |
+
|
290 |
+
$script = "
|
291 |
+
<script type='text/javascript'>\n
|
292 |
+
/* <![CDATA[ */ \n
|
293 |
+
{$script}
|
294 |
+
\n /* ]]> */ \n
|
295 |
+
</script>
|
296 |
+
";
|
297 |
+
|
298 |
+
echo $script;
|
299 |
+
}
|
300 |
+
|
301 |
+
/**
|
302 |
+
* Content Helper
|
303 |
+
*
|
304 |
+
* @since 0.1
|
305 |
+
*/
|
306 |
+
function content_helper( $content, $paragraph_tag = false, $br_tag = false )
|
307 |
+
{
|
308 |
+
$content = preg_replace('#^<\/p>|^<br \/>|<p>$#', '', $content);
|
309 |
+
|
310 |
+
if ( $br_tag ) {
|
311 |
+
$content = preg_replace('#<br \/>#', '', $content);
|
312 |
+
}
|
313 |
+
|
314 |
+
if ( $paragraph_tag ) {
|
315 |
+
$content = preg_replace('#<p>|</p>#', '', $content);
|
316 |
+
}
|
317 |
+
|
318 |
+
return do_shortcode( shortcode_unautop( trim($content) ) );
|
319 |
+
}
|
320 |
+
}
|
321 |
+
|
322 |
+
new Codepress_Column_Shortcodes();
|
323 |
+
|
324 |
+
?>
|
languages/column-shortcodes-nl_NL.mo
ADDED
Binary file
|
languages/column-shortcodes-nl_NL.po
ADDED
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
msgid ""
|
2 |
+
msgstr ""
|
3 |
+
"Project-Id-Version: Column Shortcodes\n"
|
4 |
+
"Report-Msgid-Bugs-To: \n"
|
5 |
+
"POT-Creation-Date: 2012-07-20 15:46+0100\n"
|
6 |
+
"PO-Revision-Date: 2012-07-20 15:46+0100\n"
|
7 |
+
"Last-Translator: Codepress <info@codepress.nl>\n"
|
8 |
+
"Language-Team: Codepress <info@codepress.nl>\n"
|
9 |
+
"MIME-Version: 1.0\n"
|
10 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
+
"Content-Transfer-Encoding: 8bit\n"
|
12 |
+
"X-Poedit-KeywordsList: __;_e\n"
|
13 |
+
"X-Poedit-Basepath: .\n"
|
14 |
+
"X-Poedit-SourceCharset: utf-8\n"
|
15 |
+
"X-Poedit-SearchPath-0: .\n"
|
16 |
+
"X-Poedit-SearchPath-1: ..\n"
|
17 |
+
|
18 |
+
#: ../column-shortcodes.php:174
|
19 |
+
msgid "Select shortcode"
|
20 |
+
msgstr "Selecteer shortcode "
|
21 |
+
|
22 |
+
#: ../column-shortcodes.php:208
|
23 |
+
msgid "Column shortcodes"
|
24 |
+
msgstr "Kolom shortcodes"
|
25 |
+
|
26 |
+
#: ../column-shortcodes.php:231
|
27 |
+
msgid "one half"
|
28 |
+
msgstr "half"
|
29 |
+
|
30 |
+
#: ../column-shortcodes.php:232
|
31 |
+
msgid "one third"
|
32 |
+
msgstr "een derde"
|
33 |
+
|
34 |
+
#: ../column-shortcodes.php:233
|
35 |
+
msgid "one fourth"
|
36 |
+
msgstr "een vierde"
|
37 |
+
|
38 |
+
#: ../column-shortcodes.php:234
|
39 |
+
msgid "two third"
|
40 |
+
msgstr "tweederde"
|
41 |
+
|
42 |
+
#: ../column-shortcodes.php:235
|
43 |
+
msgid "three fourth"
|
44 |
+
msgstr "drie vierde"
|
45 |
+
|
46 |
+
#: ../column-shortcodes.php:236
|
47 |
+
msgid "one fifth"
|
48 |
+
msgstr "een vijfde"
|
49 |
+
|
50 |
+
#: ../column-shortcodes.php:237
|
51 |
+
msgid "two fifth"
|
52 |
+
msgstr "twee vijfde"
|
53 |
+
|
54 |
+
#: ../column-shortcodes.php:238
|
55 |
+
msgid "three fifth"
|
56 |
+
msgstr "drie vijfde"
|
57 |
+
|
58 |
+
#: ../column-shortcodes.php:239
|
59 |
+
msgid "one sixth"
|
60 |
+
msgstr "een zesde"
|
61 |
+
|
62 |
+
#: ../column-shortcodes.php:255
|
63 |
+
msgid "last"
|
64 |
+
msgstr "laatste"
|
65 |
+
|
languages/column-shortcodes.po
ADDED
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
msgid ""
|
2 |
+
msgstr ""
|
3 |
+
"Project-Id-Version: Column Shortcodes\n"
|
4 |
+
"Report-Msgid-Bugs-To: \n"
|
5 |
+
"POT-Creation-Date: 2012-07-20 15:46+0100\n"
|
6 |
+
"PO-Revision-Date: 2012-07-20 15:46+0100\n"
|
7 |
+
"Last-Translator: Codepress <info@codepress.nl>\n"
|
8 |
+
"Language-Team: Codepress <info@codepress.nl>\n"
|
9 |
+
"MIME-Version: 1.0\n"
|
10 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
+
"Content-Transfer-Encoding: 8bit\n"
|
12 |
+
"X-Poedit-KeywordsList: __;_e\n"
|
13 |
+
"X-Poedit-Basepath: .\n"
|
14 |
+
"X-Poedit-SourceCharset: utf-8\n"
|
15 |
+
"X-Poedit-SearchPath-0: .\n"
|
16 |
+
"X-Poedit-SearchPath-1: ..\n"
|
17 |
+
|
18 |
+
#: ../column-shortcodes.php:174
|
19 |
+
msgid "Select shortcode"
|
20 |
+
msgstr ""
|
21 |
+
|
22 |
+
#: ../column-shortcodes.php:208
|
23 |
+
msgid "Column shortcodes"
|
24 |
+
msgstr ""
|
25 |
+
|
26 |
+
#: ../column-shortcodes.php:231
|
27 |
+
msgid "one half"
|
28 |
+
msgstr ""
|
29 |
+
|
30 |
+
#: ../column-shortcodes.php:232
|
31 |
+
msgid "one third"
|
32 |
+
msgstr ""
|
33 |
+
|
34 |
+
#: ../column-shortcodes.php:233
|
35 |
+
msgid "one fourth"
|
36 |
+
msgstr ""
|
37 |
+
|
38 |
+
#: ../column-shortcodes.php:234
|
39 |
+
msgid "two third"
|
40 |
+
msgstr ""
|
41 |
+
|
42 |
+
#: ../column-shortcodes.php:235
|
43 |
+
msgid "three fourth"
|
44 |
+
msgstr ""
|
45 |
+
|
46 |
+
#: ../column-shortcodes.php:236
|
47 |
+
msgid "one fifth"
|
48 |
+
msgstr ""
|
49 |
+
|
50 |
+
#: ../column-shortcodes.php:237
|
51 |
+
msgid "two fifth"
|
52 |
+
msgstr ""
|
53 |
+
|
54 |
+
#: ../column-shortcodes.php:238
|
55 |
+
msgid "three fifth"
|
56 |
+
msgstr ""
|
57 |
+
|
58 |
+
#: ../column-shortcodes.php:239
|
59 |
+
msgid "one sixth"
|
60 |
+
msgstr ""
|
61 |
+
|
62 |
+
#: ../column-shortcodes.php:255
|
63 |
+
msgid "last"
|
64 |
+
msgstr ""
|
65 |
+
|
readme.txt
ADDED
@@ -0,0 +1,116 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
=== Column Shortcodes ===
|
2 |
+
Contributors: tschutter
|
3 |
+
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=ZDZRSYLQ4Z76J
|
4 |
+
Tags: columns, column, shortcodes, shortcode, divider, layout, posts, editor, wp-admin, admin, codepress, wordpress
|
5 |
+
Requires at least: 3.1
|
6 |
+
Tested up to: 3.4
|
7 |
+
Stable tag: 0.1
|
8 |
+
|
9 |
+
== Description ==
|
10 |
+
|
11 |
+
Adds shortcodes to easily create columns in your posts or pages.
|
12 |
+
|
13 |
+
Sometimes you just need to divide your page into different columns. With this plugin you just select a column shortcode and it will add the column to the page.
|
14 |
+
|
15 |
+
There are 9 different column widths available from which you can make all combinations:
|
16 |
+
|
17 |
+
* half (1/2)
|
18 |
+
* one third (1/3)
|
19 |
+
* two third (2/3)
|
20 |
+
* one fourth (1/4)
|
21 |
+
* three fourth (3/4)
|
22 |
+
* one fifth (1/5)
|
23 |
+
* two fifth (2/5)
|
24 |
+
* three fifth (3/5)
|
25 |
+
* one sixth (1/6)
|
26 |
+
|
27 |
+
A preset stylesheet is included, which you can also overwrite to you liking in your theme's stylesheet.
|
28 |
+
|
29 |
+
**Related Links:**
|
30 |
+
|
31 |
+
* http://www.codepress.nl/
|
32 |
+
|
33 |
+
== Installation ==
|
34 |
+
|
35 |
+
1. Upload column-shortcodes to the /wp-content/plugins/ directory
|
36 |
+
2. Activate Column Shortcodes through the 'Plugins' menu in WordPress
|
37 |
+
3. A shortcode icon is added to the text editor where you can pick your column shortcode.
|
38 |
+
|
39 |
+
== Frequently Asked Questions ==
|
40 |
+
|
41 |
+
= Where do I add my content? =
|
42 |
+
|
43 |
+
When you have selected a shorcode it will be placed in you editor. You will see something like this:
|
44 |
+
|
45 |
+
`
|
46 |
+
[one_half][/one_half]
|
47 |
+
`
|
48 |
+
|
49 |
+
Make sure to place you content (text/images etc. ) between the two shortcodes, like so:
|
50 |
+
|
51 |
+
`
|
52 |
+
[one_half]My content goes here...[/one_half]
|
53 |
+
`
|
54 |
+
|
55 |
+
= Will you be adding more shortcodes? =
|
56 |
+
|
57 |
+
We would love to hear your feedback and suggestions on this. Just send an email to <a href="mailto:info@codepress.nl">info@codepress.nl</a>.
|
58 |
+
|
59 |
+
= How can I contribute a translation? =
|
60 |
+
|
61 |
+
You will find a .po file in the languages folder which you can use. You can send the translation to <a href="mailto:info@codepress.nl">info@codepress.nl</a>.
|
62 |
+
|
63 |
+
= How can I replace the default Shortcode CSS stylesheet? =
|
64 |
+
|
65 |
+
You can easily overwrite the existing stylesheet. For example you would like to add a margin between your columns, you just place the following in your theme's style.css:
|
66 |
+
|
67 |
+
`
|
68 |
+
.one_half {
|
69 |
+
width: 48%;
|
70 |
+
margin-right: 2%;
|
71 |
+
}
|
72 |
+
.one_third {
|
73 |
+
width: 32%;
|
74 |
+
margin-right: 1.3%;
|
75 |
+
}
|
76 |
+
.two_third {
|
77 |
+
width: 64%;
|
78 |
+
margin-right: 2.6%;
|
79 |
+
}
|
80 |
+
.one_fourth {
|
81 |
+
width: 24%;
|
82 |
+
margin-right: 1%;
|
83 |
+
}
|
84 |
+
.three_fourth {
|
85 |
+
width: 72%;
|
86 |
+
margin-right: 3%;
|
87 |
+
}
|
88 |
+
.one_fifth {
|
89 |
+
width: 19%;
|
90 |
+
margin-right: 1%;
|
91 |
+
}
|
92 |
+
.two_fifth {
|
93 |
+
width: 38%;
|
94 |
+
margin-right: 2%;
|
95 |
+
}
|
96 |
+
.three_fifth {
|
97 |
+
width: 57%;
|
98 |
+
margin-right: 3%;
|
99 |
+
}
|
100 |
+
.one_sixth {
|
101 |
+
width: 16%;
|
102 |
+
margin-right: 0.6%;
|
103 |
+
}
|
104 |
+
`
|
105 |
+
|
106 |
+
== Screenshots ==
|
107 |
+
|
108 |
+
1. Editor with shortcode icon
|
109 |
+
2. Shortcode popup with shortcode selector
|
110 |
+
3. Example post with the use of column shortcodes
|
111 |
+
|
112 |
+
== Changelog ==
|
113 |
+
|
114 |
+
= 0.1 =
|
115 |
+
|
116 |
+
* Initial release.
|
screenshot-1.png
ADDED
Binary file
|
screenshot-2.png
ADDED
Binary file
|
screenshot-3.png
ADDED
Binary file
|