Permalink
Browse files

Merge tag '0.2.0'

Tagging version 0.2.0.
  • Loading branch information...
justintadlock committed Oct 4, 2013
2 parents 95c3bb8 + d161944 commit b7ad4f0dc0a12faffc468984291dd8788f131a2b
Showing with 218 additions and 90 deletions.
  1. +54 −3 css/columns.css
  2. +1 −1 css/columns.min.css
  3. +0 −53 docs/readme.html
  4. +37 −10 grid-columns.php
  5. +63 −0 readme.md
  6. +63 −23 readme.txt
View
@@ -1,9 +1,9 @@
/**
* CSS for handling the [column] shortcode styles.
*
- * @version 20121007
+ * @version 20130123
* @author Justin Tadlock <justin@justintadlock.com>
- * @copyright Copyright (c) 2012, Justin Tadlock
+ * @copyright Copyright (c) 2013, Justin Tadlock
* @link http://justintadlock.com
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*/
@@ -32,6 +32,15 @@
margin-left: 0;
}
+/* Some rules in case wpautop() goes a little crazy. */
+.column-grid br,
+.column-grid p:empty {
+ display: none;
+ }
+.column-grid .column br {
+ display: block;
+ }
+
/**
* Formula for getting the width of each column.
* $width = ( 100 + $margin-right ) / ( $grid ) * ( $span ) - ( $margin_right )
@@ -108,4 +117,46 @@
.column-grid-12 .column-push-4 { margin-left: 35%; }
.column-grid-12 .column-push-3 { margin-left: 26.25%; }
.column-grid-12 .column-push-2 { margin-left: 17.5%; }
-.column-grid-12 .column-push-1 { margin-left: 8.75%; }
+.column-grid-12 .column-push-1 { margin-left: 8.75%; }
+
+/* === Right-to-Left === */
+
+.rtl .column-grid .column {
+ float: right;
+ margin-left: 5%;
+ margin-right: 0;
+ }
+.rtl .column-grid .column-first {
+ margin-right: 0;
+ }
+.rtl .column-grid .column-last {
+ float: left;
+ margin-right: 0;
+ margin-left: 0;
+ }
+
+.rtl .column-grid-2 .column-push-1 { margin-right: 52.5%; }
+
+.rtl .column-grid-3 .column-push-2 { margin-right: 70%; }
+.rtl .column-grid-3 .column-push-1 { margin-right: 35%; }
+
+.rtl .column-grid-4 .column-push-3 { margin-right: 78.75%; }
+.rtl .column-grid-4 .column-push-2 { margin-right: 52.5%; }
+.rtl .column-grid-4 .column-push-1 { margin-right: 26.25%; }
+
+.rtl .column-grid-5 .column-push-4 { margin-right: 84%; }
+.rtl .column-grid-5 .column-push-3 { margin-right: 63%; }
+.rtl .column-grid-5 .column-push-2 { margin-right: 42%; }
+.rtl .column-grid-5 .column-push-1 { margin-right: 21%; }
+
+.rtl .column-grid-12 .column-push-11 { margin-right: 96.25%; }
+.rtl .column-grid-12 .column-push-10 { margin-right: 87.5%; }
+.rtl .column-grid-12 .column-push-9 { margin-right: 78.75%; }
+.rtl .column-grid-12 .column-push-8 { margin-right: 69%; }
+.rtl .column-grid-12 .column-push-7 { margin-right: 61.25%; }
+.rtl .column-grid-12 .column-push-6 { margin-right: 52.5%; }
+.rtl .column-grid-12 .column-push-5 { margin-right: 43.75%; }
+.rtl .column-grid-12 .column-push-4 { margin-right: 35%; }
+.rtl .column-grid-12 .column-push-3 { margin-right: 26.25%; }
+.rtl .column-grid-12 .column-push-2 { margin-right: 17.5%; }
+.rtl .column-grid-12 .column-push-1 { margin-right: 8.75%; }
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View
@@ -22,24 +22,11 @@ <h1>Grid Columns</h1>
<h2>Table of Contents</h2>
<ul>
- <li><a href="#install">How to install the plugin</a></li>
<li><a href="#how">How the plugin works</a></li>
<li><a href="#basic">Basic usage</a></li>
<li><a href="#advanced">Advanced usage</a></li>
- <li><a href="#faq">Frequently-asked questions</a></li>
- <li><a href="#support">Support</a></li>
- <li><a href="#copyright">Copyright and License</a></li>
</ul>
-<h2 id="install">How to install the plugin</h2>
-
-<ol>
- <li>Uzip the <code>grid-columns.zip</code> folder.</li>
- <li>Upload the <code>grid-columns</code> folder to your <code>/wp-content/plugins</code> directory.</li>
- <li>In your WordPress dashboard, head over to the <em>Plugins</em> section.</li>
- <li>Activate <em>Grid Columns</em>.</li>
-</ol>
-
<h2 id="how">How does it work?</h2>
<p>The plugin provides you with a shortcode called <code>[column]</code>. It allows you to create columnized content.</p>
@@ -189,45 +176,5 @@ <h3>Example #7</h3>
<div class="column column-span-1 column-push-1 column-last"><p>This is some very cool example content to use as an example.</p></div>
</div>
-<h2 id="faq">Frequently-asked questions</h2>
-
-<h3>Help! My site's broken! What should I do?</h3>
-
-<p>Most likely, it's because you either have too many spans or not enough spans for your grid. Make sure each <code>span</code> argument for your <code>[column]</code> shortcode equals exactly the <code>grid</code> argument.</p>
-
-<h3>But, I did everything right.</h3>
-
-<p>If you're absolutely sure you're math is correct, it could be a conflict with your theme. It'd be impossible for me to know without seeing it in use on your site, so you'll either need to ask on my support forums or get your theme developer to help.</p>
-
-<h3>Can I have more than one set of grid columns in a post?</h3>
-
-<p>Yes. Absolutely. Just make sure each grid has the correct number of columns before starting a new one.</p>
-
-<h3>Can I nest columns?</h3>
-
-<p>No. This is a limitation of WordPress.</p>
-
-<h3>Can I use other shortcodes within the <code>[column]</code> shortcode?</h3>
-
-<p>Yes, you can. However, keep in mind, that I can't guarantee that your plugin developer knows what he's doing and created his shortcode correctly. But, yes, you can do this with properly-coded shortcodes.</p>
-
-<h3>Can I put content between two different column shortcodes?</h3>
-
-<p>It's possible, but you'll probably break something. I recommend against attempting this.</p>
-
-<h2 id="support">Plugin support</h2>
-
-<p>I run a WordPress community called <a href="http://themehybrid.com" title="Theme Hybrid">Theme Hybrid</a>, which is where I fully support all of my WordPress projects, including plugins. You can sign up for an account to get plugin support for a small yearly fee ($29 <acronym title="United States Dollars">USD</acronym> at the time of writing).</p>
-
-<p>I know. I know. You might not want to pay for support, but just consider it a donation to the project. To continue making cool, <acronym title="GNU General Public License">GPL</acronym>-licensed plugins and having the time to support them, I must pay the bills.</p>
-
-<h2 id="copyright">Copyright and license</h2>
-
-<p>Grid Columns is licensed under the <a href="http://www.gnu.org/licenses/old-licenses/gpl-2.0.html" title="GNU GPL">GNU General Public License</a>, version 2 (or later).</p>
-
-<p>This plugin is copyrighted to <a href="http://justintadlock.com" title="Justin Tadlock">Justin Tadlock</a>.</p>
-
-<p>2012 &copy; Justin Tadlock.</p>
-
</body>
</html>
View
@@ -3,7 +3,7 @@
* Plugin Name: Grid Columns
* Plugin URI: http://themehybrid.com/plugins/grid-columns
* Description: A [column] shortcode plugin.
- * Version: 0.1.1
+ * Version: 0.2.0
* Author: Justin Tadlock
* Author URI: http://justintadlock.com
*
@@ -23,15 +23,24 @@
* to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* @package GridColumns
- * @version 0.1.1
+ * @version 0.2.0
* @author Justin Tadlock <justin@justintadlock.com>
- * @copyright Copyright (c) 2012, Justin Tadlock
+ * @copyright Copyright (c) 2012 - 2013, Justin Tadlock
* @link http://themehybrid.com/plugins/grid-columns
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*/
class Grid_Columns {
+ /**
+ * Holds the instance of this class.
+ *
+ * @since 0.2.0
+ * @access private
+ * @var object
+ */
+ private static $instance;
+
/**
* The current grid.
*
@@ -87,10 +96,10 @@ class Grid_Columns {
public function __construct() {
/* Register shortcodes on 'init'. */
- add_action( 'init', array( &$this, 'register_shortcode' ) );
+ add_action( 'init', array( $this, 'register_shortcode' ) );
/* Enqueue stylesheets on 'wp_enqueue_scripts'. */
- add_action( 'wp_enqueue_scripts', array( &$this, 'enqueue_styles' ), 1 );
+ add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles' ), 1 );
/* Apply filters to the column content. */
add_filter( 'gc_column_content', 'wpautop' );
@@ -106,7 +115,7 @@ public function __construct() {
* @return void
*/
public function register_shortcode() {
- add_shortcode( 'column', array( &$this, 'do_shortcode' ) );
+ add_shortcode( 'column', array( $this, 'do_shortcode' ) );
}
/**
@@ -126,7 +135,7 @@ public function enqueue_styles() {
'grid-columns',
trailingslashit( plugin_dir_url( __FILE__ ) ) . "css/columns$suffix.css",
null,
- '20121007'
+ '20130123'
);
}
@@ -261,11 +270,29 @@ public function do_shortcode( $attr, $content = null ) {
*/
public function reset() {
- foreach ( get_class_vars( __CLASS__ ) as $name => $default )
- $this->$name = $default;
+ foreach ( get_class_vars( __CLASS__ ) as $name => $default ) {
+
+ if ( 'instance' !== $name )
+ $this->$name = $default;
+ }
+ }
+
+ /**
+ * Returns the instance.
+ *
+ * @since 0.2.0
+ * @access public
+ * @return object
+ */
+ public static function get_instance() {
+
+ if ( !self::$instance )
+ self::$instance = new self;
+
+ return self::$instance;
}
}
-new Grid_Columns();
+Grid_Columns::get_instance();
?>
View
@@ -0,0 +1,63 @@
+# Grid Columns
+
+A `[column]` shortcode for creating columnized content.
+
+This plugin has one function and one function only &mdash; to make columns. You use it by inputting content between `[column]` and `[/column]` within your post content editor (or anywhere shortcodes are allowed).
+
+Grid Columns was created to fix the problem in which many theme developers were adding 20+ column shortcodes to their themes for something that should be extremely simple and done with only a single shortcode.
+
+## Why the plugin was created
+
+Many theme developers add several column shortcodes to their themes (note: this isn't allowed on WordPress.org). Essentially, the theme developers are doing a few things wrong:
+
+* They lock users into using their themes forever.
+* They create 20+ shortcodes for what is possible for one. This makes it look like their themes have more "features".
+* They remove core WordPress filters that other plugins rely on.
+* The code is just poorly developed altogether (most likely because they all copied from the same, bad source).
+
+This plugin allows you to switch between any theme (no lock-in to your current theme). It was also developed with WordPress standards and usability in mind.
+
+## Uage
+
+You can find more detailed instructions in the plugin's `docs/readme.html` file.
+
+Everything is based on a grid. By default, this grid is "4". So, you can set up four columns like so:
+
+ [column grid="4" span="1"]Some content[/column]
+
+ [column grid="4" span="1"]Some content[/column]
+
+ [column grid="4" span="1"]Some content[/column]
+
+ [column grid="4" span="1"]Some content[/column]
+
+You'll notice that each "span" is equal to the number of columns in the grid. So, if the span is "1", it's equal to one column. If the span is "2", it's equal to two columns. You can only have as many spans/columns as the grid allows. Therefore, `grid="4"` means you can only have four columns.
+
+## Changelog
+
+### Version 0.2.0
+
+* Added CSS style rules to override some issues with WordPress' `wpautop()`, which sometimes adds empty `<p>` and extra `<br />` tags.
+* Added support for right-to-left languages.
+* No more anonymous objects created by the plugin class.
+* No need for `&` when adding an action/filter.
+
+### Version 0.1.1
+
+* Add more specific prefixes in the CSS.
+* Add some better margin handling in case other CSS code is overwriting things willy-nilly.
+* Add the `gc_column_content` filter hook and use it to apply formatting.
+
+### Version 0.1.0
+
+* Plugin released. Everything is new!
+
+## Professional Support
+
+If you need professional plugin support from me, the plugin author, you can access the support forums at [Theme Hybrid](http://themehybrid.com/support), which is a professional WordPress help/support site where I handle support for all my plugins and themes for a community of 40,000+ users (and growing).
+
+## Copyright and License
+
+This project is licensed under the [GNU GPL](http://www.gnu.org/licenses/old-licenses/gpl-2.0.html), version 2 or later.
+
+2012&thinsp;&ndash;&thinsp;2013 &copy; [Justin Tadlock](http://justintadlock.com).
Oops, something went wrong.

0 comments on commit b7ad4f0

Please sign in to comment.