GithubHelp home page GithubHelp logo

automattic / zoninator Goto Github PK

View Code? Open in Web Editor NEW
86.0 125.0 52.0 500 KB

Curation made easy! Create "zones" then add and order your content straight from the WordPress Dashboard.

Home Page: https://wordpress.org/plugins/zoninator/

CSS 9.07% PHP 83.08% JavaScript 5.74% Shell 2.11%
wordpress wordpress-plugin wpvip-plugin

zoninator's Introduction

Zone Manager (Zoninator)

Content curation made easy! Create "zones" then add and order your content! Assign and order stories within zones that you create, edit, and delete. Then use the handy API functions to retrieve and display your content in your theme. Or for those who are a bit code-averse, try the handy widget.

What does this plugin do?

This plugin is designed to help you curate your content. It lets you assign and order stories within zones that you create, edit, and delete, and display those groupings of related stories on your site.

How do I set it up?

After activating the plugin, you'll see a new "Zones" tab in your Dashboard's sidebar menu:

zones

Create your zones, and easily search for and add existing posts.

Once you've set up your zones, use the handy API functions to retrieve and display your content in your theme. Or, for those who are a bit code-averse, go to Appearance-Widgets and add Zone Posts widgets to display your zone posts in your sidebar or footer:

zone widget

The widget will pull the posts from the chosen zone:

zone display

More documentation for the plugin can be found on the WordPress.org plugin page.

Usage examples

You can work with with a zone's posts either as an array or a WP_Query object.

WP_Query

$zone_query = z_get_zone_query( 'homepage' );
if ( $zone_query->have_posts() ) :
    while ( $zone_query->have_posts() ) : $zone_query->the_post();
        echo '<li>' . get_the_title() . '</li>';
    endwhile;
endif;
wp_reset_query();

Posts Array

$zone_posts = z_get_posts_in_zone( 'homepage' );
foreach ( $zone_posts as $zone_post ) :
    echo '<li>' . get_the_title( $zone_post->ID ) . '</li>';
endforeach;

FUNCTION REFERENCE

Get an array of all zones:

z_get_zones()

Get a single zone. Accepts either ID or slug.

z_get_zone( $zone )

Get an array of ordered posts in a given zone. Accepts either ID or slug.

z_get_posts_in_zone( $zone )

Get a WP_Query object for a given zone. Accepts either ID or slug.

z_get_zone_query( $zone );

More functions listed in functions.php

zoninator's People

Contributors

andfinally avatar attackant avatar bcampeau avatar brettshumaker avatar david-binda avatar davisshaver avatar dlh01 avatar garyjones avatar ice9js avatar jasonbahl avatar jblz avatar jessedyck avatar joshbetz avatar kingyes avatar lpmi-13 avatar maevelander avatar mboynes avatar mjangda avatar nickdaugherty avatar pgk avatar philipjohn avatar pkevan avatar rebeccahum avatar sboisvert avatar sjinks avatar szepeviktor avatar trepmal avatar vaurdan avatar vhuynh617 avatar yolih avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

zoninator's Issues

Versioning in Wpackagist

Hello,

We noticed that the versioning of your plugin is off at https://wpackagist.org/search?q=zoninator

It's not picking up the 0.7 release and it is still pulling the 0.6 version with the deprecated constructor name in Zoninator_ZonePosts_Widget.

Is there any way you can push the release to https://wpackagist.org? Do you have any plans to add the plugin to https://packagist.org/?

Thank you in advance!

Slow queries generated by Zoninator

We have seen slow queries being generated by Zoninator, in particular a query that looks like this:

SELECT wp_posts.ID FROM wp_posts WHERE ?=? AND ( wp_posts.post_date > ?) AND wp_posts.ID NOT IN (?, ?, ?, ?, ?, ?, ?, ?) AND (((wp_posts.post_title LIKE ?) OR (wp_posts.post_excerpt LIKE ?) OR (wp_posts.post_content LIKE ?))) AND wp_posts.post_type = ? AND ((wp_posts.post_status = ? OR wp_posts.post_status = ?)) ORDER BY wp_posts.post_date DESC LIMIT ?, ?

It is in particular the NOT IN part that causes issues, as when data grows in wp_posts, there is more to exclude when processing the query. This can lead the database to overload, causing sites to have performance issues.

Is there any way to rewrite this without the NOT IN?


This issue originated as a VIP Request.

Zone Feeds

Automatically create feeds for each zone that return a zone's posts: /zones/my-zone-slug/feed/

Suggested by John Cionci.

Add method/API function to add a post type to zoninator

Currently the code to add support to a post_type to Zoninator seems to be as follows:

add_post_type_support( 'video', $GLOBALS[ 'zoninator' ]->zone_taxonomy );
register_taxonomy_for_object_type( $GLOBALS[ 'zoninator' ]->zone_taxonomy, 'video' );

// Clear Zoninator supported post types cache
unset( $GLOBALS[ 'zoninator' ]->post_types );

Would be good to have a simpler API method or function.

Related: #2

WordPress 4.2 Term Splitting

Zoninator needs to be patched to deal with potential term splitting issues as of 4.2.

The main issue is that posts are related to zones via meta key, and that meta key is a reference to the zone's term ID. If a zone were to be updated (not its posts, but the zone itself), and that zone were a shared term, it would be split and the post relationships would be broken.

Deprecation notice in widget in PHP 7.0

PHP Deprecated:  Methods with the same name as their class will not be constructors in a future version of PHP; Zoninator_ZonePosts_Widget has a deprecated constructor in /tmp/wordpress/src/wp-content/plugins/zoninator/widget.zone-posts.php on line 6

Convert existing AJAX endpoints into WP API

As of 4.4, WordPress includes WP API infrastructure and provides a framework for creating custom REST endpoints. It is suggested that plugin authors convert their custom AJAX based APIs to use WP API.

The goal is to convert zoninator's existing AJAX endpoints into WP API, along with all the JavaScript client-side changes required.

Drag and Drop on Mobile Issue

It looks like the drag-and-drop is not working on mobile devices. If you touch one of the stories in the zones to change the rank, it will scroll all the way to the bottom making it impossible to move the stories up or around. This was reproduced on iPhone6/iPhone6+ in Safari/Chrome. However, this does work properly on iPad.

UI Improvements

The current UI for managing zones was inspired by the Menus UI. Sadly, this doesn't "scale" when you have lots and lots of zones.

Duplicate WP_Queries in get_zone_posts

I'm trying to perform some actions on each query being executed on a page, using the pre_get_posts action. I'm finding that zoninator loops are executing the query twice for each loop when I use z_get_posts_in_zone to get a list of arrays.

The first one is in zoninator.php on line 1012. get_zone_posts() runs get_zone_query() which returns a new WP_Query back to get_zone_posts. https://github.com/Automattic/zoninator/blob/master/zoninator.php#L1056

The second is when get_posts is called on that query on line 1013 here. get_posts() also also creates a new WP_Query as you can see here.

I couldn't find anything to support this being the desired effect, and I can't think of a scenario in this case where running 2 queries would be needed.

get_zone_query() function not working on 5.7

It doesn't display posts for a zone, on the backend below is an error in the query generated by get_zone_query() method:

WordPress database error Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column 'wordpress.wp_postmeta.meta_value' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by for query SELECT wp_posts.* FROM wp_posts INNER JOIN wp_postmeta ON ( wp_posts.ID = wp_postmeta.post_id ) WHERE 1=1 AND ( \n wp_postmeta.meta_key = '_zoninator_order_4942'\n) AND wp_posts.post_type = 'post' AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'future' OR wp_posts.post_status = 'draft' OR wp_posts.post_status = 'pending' OR wp_posts.post_status = 'private') GROUP BY wp_posts.ID ORDER BY wp_postmeta.meta_value+0 ASC made by WP_Query::get_posts, referer: http://localhost/wordpress/wp-admin/admin.php?page=zoninator

Further, executed the select query directly on mysql, got the following response:

Error Code: 1055. Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column 'wordpress.wp_postmeta.meta_value' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by

Checked mysql documentation and got the following from there:

https://dev.mysql.com/doc/refman/5.7/en/group-by-handling.html

Please check the issue.

Thanks.

Enhanced widget

For users who don't have access to modifying their PHP, it would be nice to include an enhanced widget where they can set the layout with template tags and basic HTML.

Example:

<div class="post-thumbnail">%thumbnail%</div>
<h4>%title%</h4>
<p>%excerpt%</p>

Or something similar where you can pass parameters.

get_supported_post_types() shouldn't fire on init

Because it does, $this->post_types becomes set without potentially additional post types that just happen to be registered after.

It doesn't look like that class variable is ever used, so it would probably be better to remove it altogether.

Also, the taxonomy should be registered with post types on late init to ensure all post types have been registered.

WordPress 4.4 broke the nav

WordPress 4.4 broke the CSS for the left nav. It reverted to the old tab design in a jumbled list. Will be working on a fix for this later today.

Creating a more friendly way of unlocking zones

Currently when the zone lock times out the user is forced back to the tab/window where they were locked into a zone.

This is pretty bad UX and it would be nicer if it just silently took them out of the zone.

Reporting in Chrome (latest version) on Windows/Mac

Zone Shortcode

Would like to see a Zone Manager shortcode with the ability to add loops to pages.
For example:

[zonemanager zone="developingnews" showposts="1"]

Create zones for PHPUnit testing.

Hi,

Is it possible to create a test zone for unit testing?

I have a situation where my right rail template will load only if there is a zone that populates the videos in that right rail. Now, my unit test fails because the right rail is never generated in my test post.

I looked up your code. All the setter methods are private, which makes it really hard to create any test data.

Any thoughts ?

Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.