This plugin hasn’t been tested with the latest 3 major releases of WordPress. It may no longer be maintained or supported and may have compatibility issues when used with more recent versions of WordPress.

Cactus Masonry Classic



Cactus Masonry Classic has been superseded by Cactus Masonry Plus. Cactus Masonry Plus is also free and available in the WordPress plugin repository.

What is Cactus Masonry Classic?

Cactus Masonry Classic (which we will call CMC from now on), is a WordPress plugin designed to display a gallery of post and/or page featured images that can be filtered, sorted, and treated as hyperlinks.

In other words, a CMC gallery will display a list of all matching posts which link back to their permalinks when clicked! This functionality would be perfect for an art or photo gallery where further information needs to be displayed on each item. Of course, you can choose where each picture links, whether back to the original image (at a size of your choosing), the original post, a Lightbox styled gallery, or nowhere at all.

As CMC essentially searches your WordPress site for posts, you can specify which category (or categories) of post to display, and sort those posts by date, comment count, author, randomly, and more!

You can also specify the layout options for the pictures. By default, the pictures are positioned in a masonry styled layout, where the images are slotted into each other like irregular bricks in an old stone wall. However, you can force the plugin to restrict or constrain the heights or widths of the images to create a tidy and whitespace free gallery of images. Check out the Cactus Masonry Classic Home Page for an example where the width has been constrained to 33.3%.

You may also specify how the images glow when the user’s mouse hovers overhead, whether the images have borders, and how much (if any) spacing should exist between each image.

The Cactus Masonry Classic plugin provides a versatile WordPress plugin that allows you to display your posts by their thumbnail in a clean and visually pleasing format.

Can I See it In Action?

Yes, go to the main page of Cactus Masonry Classic Website to check it out!

Does it Cost Money?

No, it’s all free to use. This is not one of those “free” plugins that require a payment before you can use any of its useful features. This is completely free – no watermarks, no ads, no nagging. Just one free plugin.

However, it did take a fair amount of time to make… so if you are feeling generous… feel free to donate something. But no pressure or anything :).

Can I Make a Feature Request?

CMC has reached the end of its supported life. Bug fixes will still be issued, but new features are unlikely to be released.

CMC has now been replaced by Cactus Masonry Plus. This plugin is a total rebuild of CMC, including improved performance, fewer and smaller files, and a whole bunch of new features.

Cactus Masonry Plus is also free, but it is also open to new feature requests. To find out more, visit the Cactus Masonry Plus Website.


  • The Shortcode Generator webpage

  • The Shortcode Generator webpage

  • A gallery with the following shortcode: [cactus-masonry link_location=’medium’ post_orderby=’rand’ width=’50%’ horizontal_spacing=’20’ vertical_spacing=’20’ border_thickness=’5px’ border_color=’white’ outer_border_thickness=’5px’ show_lightbox=’true’]

  • A gallery with the following shortcode: [cactus-masonry width=’25%’ horizontal_spacing=’0′ vertical_spacing=’0′]

  • A gallery with the following shortcode: [cactus-masonry width=’33.33%’]

  • A gallery with the following shortcode: [cactus-masonry display_post_titles=’true’ display_post_excerpts=’true’ width=’33.33%’]

  • A gallery with the following shortcode: [cactus-masonry width=’50%’ horizontal_spacing=’20’ vertical_spacing=’20’ border_thickness=’5px’ border_color=’white’ outer_border_thickness=’5px’]

  • A gallery with the following shortcode: [cactus-masonry width=’250px’ horizontal_spacing=’20’ vertical_spacing=’20’]


Just click the Download link and Activate it!

CMC can also be downloaded from the Cactus Masonry Classic Website as a zip file for manual installation.

If you choose to install CMC manually it is important that you install the plugin in the correct folder. While CMC will work from any folder, changing the folder will affect your ability to automatically receive new updates.

The correct folder for CMC is a folder called masonry-post-gallery within your WordPress plugins folder. By default the path should be wp-content/plugins/masonry-post-gallery/.

How Do I Use Cactus Masonry Classic?

Simple. If you can use a shortcode, then you can use CMC.

A shortcode is a special piece of code you can insert into your WordPress posts and pages which links to an active plugin. If you insert [cactus-masonry] into one of your posts, you will see the CMC gallery appear when you view (or preview) that post.

The shortcode can take a variety of parameters. For example, [cactus-masonry width=”33.33%”] will generate a gallery were each image is a third of the page wide. An example of this can be seen on the main page of the CMC Website. You can use as many or as few parameters in your shortcode as you want.

For a full list of CMC’s shortcode parameters, visit the Shortcode Parameters page.

Alternately, visit the Shortcode Generator to have your shortcode made for you!

For support, visit our Support Forum.


Please refer to the FAQ page of the Cactus Masonry website.


September 3, 2016 1 reply
it is absolutely necessary to allow users to choose how many images to show in each masonry. If the image number of the site is 1000 or more, the page or post with the code will stop the site to run
September 3, 2016 2 replies
A pearl among all available masonry plugins. It’s lightweight and efficient, easy to set up and, most importantly, easy to tweak.
September 3, 2016 10 replies
Really is a nice plugin :D!
September 3, 2016 1 reply
Had to log in just to say how awesome this plugin is. If you want a masonry grid view this is all you need, so many options, but as others said you’ll need to get used to it but it only takes a few minutes to figure it out. Believe me it’s worth it. Well done and thanks for the work you put into it.
September 3, 2016
Excellent plugin, but I recommend you experiment and give yourself a few minutes to play around with the short code options. NOTE: Lazy Load conflicted with this plugin, so I uninstalled Lazy Load plugin (the theme would break on the short code page, and other odd errors). EXCELLENT plugin! 🙂
Read all 23 reviews

Contributors & Developers

“Cactus Masonry Classic” is open source software. The following people have contributed to this plugin.



  • Updated Desandro Masonry to 4.0.0

  • Added the ability to list categories on each result with the display_post_categories shortcode
  • Updated readme
  • Started rebranding to Cactus Masonry Classic
  • Some small efficiency improvements

  • Fixed a bug caused by unescaped double quotes in the title and excerpt fields
  • Added the ability to display a custom field in the databox using the display_custom_field parameter

  • Changed how the galleries are queried to create a massive performance boost on servers with limited resources
  • Added the ability to specify posts to ignore using the post_id parameter
  • Updated the help file to address the new support site

  • Compressed style sheets and javascript
  • Rebuilt javascript class to improve efficiency and scalability
  • Fixed a PHP bug that causes an error
  • Started measures for the cleanest possible transition from Cactus Masonry to Cactus Masonry Plus

  • Fixed an alignment issue that could cause the gallery to run off the page horizontally under some conditions.

  • WARNING: Updating to this version will likely affect the spacing above your gallery if you are using vertical spacing. Please check your pages after the update.
  • Fixed an error with the excerpt classname. Was originally spelled as ‘cm_exerpt’. Now spelled correctly. The original spelling also remains in place for backwards compatability.
  • Added the category_ids parameter. This allows users to filter their galleries by category ID rather than slug. Multiple comma-separated values may be used. Categories may also be excluded from the search with this parameter.
  • Added the category_and parameter. This allows the construction of a gallery of images that contain all of the listed categories.
  • Added the stamp_id parameter. This, combined with CSS, will allow users to add a sticky post to the gallery.
  • Added the category_as_brick_class parameter. This option adds the post category to each images class name for easier custom styling.
  • Added the id_as_brick_class parameter. This adds the post/page ID to the image class for targetted styling.
  • Added the author_ids parameter. Now posts can be filtered by author ID.
  • Fixed an issue where boolean parameters would not be accepted if they were written in the wrong case.
  • Fixed an issue where setting vertical spacing would cause a gap to appear above the gallery.
  • New documentation pages in progress. The shortcode generator is now out of date.

  • WARNING: Many users have manually altered the plugin to suit their particular niche needs. If you have modified the plugin, contact us before updating, and we will try to help with the migration.
  • Updated spin.js, masonry.js, imagesLoaded.js, and lightbox.js dependencies
  • Updated licensing terms.
  • Added the ability to specify a custom link rel attribute. Added by request to help with some plugin interactions. Not generally useful.
  • Set the default transition duration to zero to improve resize performance. This can be altered with the transitionDuration parameter, but setting this value may cause layout and performance issues.
  • Added the ability to open each item in a new window with the open_in_new_windows parameter
  • Fixed issue where lightbox.js was loaded even when the lightbox was switched off

  • Added the ability to search for posts by tag slug. The new tag parameter supports a tag slug or comma separated list of tag slugs.
  • You can now search for child posts of a given post only. Specify the parent post’s ID using the post_parent_id parameter.
  • Added the ability to perform a basic search using a custom taxonomy and term.
  • Added title and excerpt display to galleries where JavaScript is disabled.
  • Fixed a bug where inner borders won’t show when gallery images are cropped

  • Fixed a bug where the title and excerpt databox would appear incorrectly when masonry=false

  • Fixed a bug with custom post types
  • Cactus Masonry now broadcasts the number of posts found to help with external pagination

  • Removed BOM to stop header error

  • Fixed encoding to UTF8

  • Further fixes for the wptexturize bug which should no longer interfere with other plugins
  • Fixed an error with the page_size parameter

  • Fixed a bug with the console error caused by an non-existent image id set as the default image id
  • Fixed a major bug that may cause problems due to code changes caused by wptexturize on some sites… uh… wptexturize…

  • Removed a reference to the lightbox map file to fix a 404 warning in compatible browsers

  • WARNING: This update modifies Cactus Masonry’s CSS behaviour. There are a number of changes in place to support new features and handle Internet Explorer issues. For one, the #masonry_post_gallery selector has been changed to div.masonry_post_gallery. These changes will not affect the gallery’s default appearance – but they may affect custom CSS styling. Be sure to check your site’s appearance after updating.
  • Added the ability to select post/page-like custom post types in the gallery
  • Eliminated unnecessary site overhead caused by the plugin
  • Added the ability to manually handle the loading of external scripts to improve AJAX loading time
  • Added an override for the automatic width setting that can cause the gallery to resize its contents after external image resizing
  • Added the ability to crop images to fill each brick
  • Added the ability to specify an image background colour for added flexibility around transparent images when using the different hover colours
  • Added the option to specify an additional custom class name for the link elements in the gallery to increase compatibility with other plugins.
  • Multiple instances of Cactus Gallery can now run at the same time on the same page
  • Improved gallery functionality when masonry is switched off
  • Fixed a layout bug that may occur on some IE installs
  • Modified how image spacing works to address IE11’s inability to render basic CSS
  • Fixed some minor style issues that could cause bugs in older IE browsers
  • Fixed a major bug in IE8 to IE11 caused by (in)compatibility mode
  • Fixed a bug where the title/excerpt box can appear above the loading box
  • Fixed a bug where borders would be cut off an image with a set max-width/max-height
  • Fixed a bug where excerpts containing a line feed or carriage return would break the plugin
  • Fixed a bug where the search_start and page_size parameters fail to function correctly when there are posts present with no featured image and default_image_id is unspecified
  • Various large efficiency improvements
  • Changed how fixed (non-percentage) widths are handled to improve efficiency
  • Improved gallery functionality in situations with extremely large numbers of posts

  • Fixed a bug that can cause a PHP warning

  • A bug fix for an issue that stops posts with certain characters in their titles and excerpts from appearing in the gallery.

  • Applied some CSS enhancements to make the plugin’s styling more robust on a variety of different web environments
  • Made additions to the plugin’s FAQ section
  • Added screenshots to the WordPress plugin documentation

  • Fixed a bug that can cause the plugin to not function due to an uncommon interaction with WordPress’s wpautop ‘feature’

  • Added the ability to display a title and/or an exerpt on each image in a gallery
  • Added a CSS customization page to the website to assist with styling the gallery
  • Fixed a bug that causes the lightbox gallery to fail when loading a default image

  • Added a fix that will allow Cactus Masonry to function even if its installed in an unexpected folder on the server
  • Added version number to main div class for easier debugging
  • Added some manual installation instructions
  • Added some detail to the FAQ section of the documentation

  • Bug fix to address issue that presents itself when infinite_scroll=’false’

  • Bug fix to address older versions of PHP

  • Updated the infinite scroll to allow for IE8 compatibility
  • Fixed bug in infinite scroll code that would sometimes stop a page from loading until the user scrolled the page up
  • Improved the infinite scroll loading buffer to better address a range of scenarios
  • Removed the spinner from the loading box when run within IE8 to reduce outdated browser related bugs
  • Cleaned up code to slightly improve performance and improve backwards compatibility
  • Added parameters to allow for better gallery handling on browsers where JavaScript is disabled
  • Added the require_javascript parameter which will hide the gallery when set to true on any browser without JavaScript
  • Added the javascript_error_message parameter to set an error message that should be displayed when JavaScript is disabled
  • Fixed noscript_height and noscript_width to force images to a specific size when JavaScript is disabled.
  • Fixed a small typo and updated a link in the documentation
  • Added the upgrade notice

  • Modified documentation to improve readability
  • Fixed a bug that affected the post/page sort order since the last update

  • Added link to plugin home page in short description
  • Updated function names to reduce the chance of a conflict
  • Restructured some code to improve flow and testing capabilities
  • Added the ability to specify a default image. Now posts without a featured image can be shown if a default image is specified.
  • Added the ability to search for posts, pages, posts and pages, or nothing at all
  • Added an instructions page under the WordPress Dashboard Settings menu
  • Improved documentation on website to address new features

  • Improved plugin short description to reduce confusion
  • Reorganized code output to fix a W3C compliance issue
  • Small code layout fixes

  • Fixed an error that could occur when displaying posts with an apostrophe in their title

  • Masonry Post Gallery is renamed to Cactus Masonry
  • Improved documentation on Cactus Masonry website
  • Plugin documentation has been rewritten
  • The [cactus-masonry] shortcode can now be used (while maintaining reverse compatibility)
  • Added the search_start parameter which allows the post query to be offset by a given number of posts
  • Added the page_size parameter which allows the post query to be limited to a given number of matches

  • Implemented an option to show or hide the infinite scroll loader
  • Updated the documentation to use the masonry website and shortcode generator
  • Added links to the masonry home page to the WordPress plugin page

  • Greatly improved gallery efficiency on load and window resize
  • Fixed a layout sizing error when maxWidth is set

  • Fixed error that occurs on multipage galleries

  • Fixed script breaking bug caused by typo

  • Fixed error on IE8 that stopped images from loading
  • Fixed incompatibility with IE8 that affected the loading box
  • Now masonry disables on IE7 and earlier

  • A compatibility fix for different versions of PHP


  • Added infinite scroll functionality to improve loading speed on larger pages
  • Added the infinite_scroll parameter to toggle infinite scroll
  • Added the posts_per_page to determine the number of images to load each time with the infinite scroll
  • Made the loading box float at the top centre of the screen
  • Addressed graphical bugs with the loading box
  • Improved code efficiency
  • Removed support for the height parameter set as a percentage
  • Fixed a bug that stopped the height parameter from working properly
  • Fixed a bug that stopped the vertical spacing parameter from working properly
  • Fixed a bug that made the vertical spacing half that of the horizontal spacing
  • Fixed a bug with the hover colour parameter
  • Fixed a bug where the loading box will block mouse clicks
  • Set the default horizontal and vertical spacing values to 10


  • Fixed a bug that stopped the category parameter from working


  • Fixed a bug where the gallery would always appear at the top of the page
  • Added a number of code improvements including an external CSS file
  • Changed how the borders work to make them more reliable and even
  • Changed how the spacing and widths behave to make percentage based column layouts more reliable
  • Added a flexible border parameter called soft_gutter
  • Fixed a bug where the fit_width parameter would break the code
  • Set fit_width to “false” by default as it interacts with columns set to a percentage width causing the page to look wrong while loading
  • Made stylesheet improvements to fix minor display issues
  • Small documentation errors have been fixed
  • Published fit_width parameter to documentation
  • Updated documentation to suite changes
  • Changed the plugins version numbering system to better match WordPress standards and easier to update


  • Fixed the percentage column/row width/height functionality. Now 33% will give three columns with images fitting their column sizes.
  • Added the option to specify whether each image will link to its post, itself, a different sized version of itself, or nowhere
  • Added the capability to display a lightbox style gallery using the show_lightbox parameter
  • Removed any absolute paths to the plugins directory to make plugin more robust to future WordPress versions
  • Fixed some more bugs that have arose with certain image size and alignment functionality
  • Fixed the percentage width and height functionalities
  • Fixed a problem with boolean shortcode parameters
  • Fixed an inconsistancy in the wording of the shortcode instructions
  • Updated the documentation to recognize these changes


  • Updated upscaling feature. Now has the option to independently set max_height and max_width for upscaled objects.
  • Made MPG more functional in the absence of JavaScript.
  • Added to option to specify a grid layout that will take effect when JavaScript is disabled
  • Updated the documentation to recognize these changes


  • Added upscaling feature. Now images that are shorter or narrower than a specified width or height can be upscaled until they reach the specified size. The image thumbnail quality will be increased until it reaches the largest size available, reaches the largest size specified under the max_upscale_size parameter, or reaches or exceeds the max_height or max_width parameters.
  • Removed support for percentages in the max_height and max_width fields
  • Updated the documentation to include new features
  • Added padding to the top of the loading box


  • Incompletely implemented post_order and post_orderby parameters fixed
  • Default max_width and max_height parameters changed to “none”
  • Default horizontal_spacing and vertical_spacing set to 0
  • Minor correction made to the parameters section of the documentation to reflect these changes
  • Minor correction made to the parameters section of the documentation to fix incorrect parameter options
  • Additional information added to the parameters section of the documentation to clarify the behaviour of the vertical and horizontal spacing


  • The initial version is released. This is a testing beta, so there will be revisions, and some features may not work as planned.