Skip to content

Commit

Permalink
Added filter for Post status inside post queries
Browse files Browse the repository at this point in the history
  • Loading branch information
eclipsesrl committed Oct 2, 2019
1 parent 00b74ca commit 4833ba6
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 4 deletions.
5 changes: 4 additions & 1 deletion README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Donate link: https://www.udesly.com/
Tags: webflow to wordpress, editor, page builder, layout design, udesly, webflow
Requires at least: 5.0
Tested up to: 5.2.3
Stable tag: 2.0.0.32
Stable tag: 2.0.0.33
License: GPLv3 or later
License URI: https://www.udesly.com/terms-conditions-of-use/#udesly-wordpress-plugin
Requires PHP: 5.6.0
Expand Down Expand Up @@ -80,6 +80,9 @@ That's all!

Absolutely! You can use the Udesly Adapter to create more than one website.
== Changelog ==
= 2.0.0.33 =
* Added filter for Post status inside post queries

= 2.0.0.32 =
* Added filter for password status inside post queries

Expand Down
7 changes: 7 additions & 0 deletions includes/Blog/Blog.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@ public function public_hooks()
add_filter( 'posts_where', array($this, "password_post_filter") );
}

add_filter( 'private_title_format', function( $format ) {
return '%s';
} );
add_filter( 'protected_title_format', function( $format ) {
return '%s';
} );

}

public function filter_archive_description($description) {
Expand Down
30 changes: 29 additions & 1 deletion includes/Query/Posts.php
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,10 @@ public static function query_configuration($post)
[v-cloak] {
display: none;
}
#udesly-query-wrapper {
height: 100%;
padding-bottom: 90px;
}
</style>
<script>
jQuery(document).ready(function()
Expand Down Expand Up @@ -308,6 +312,15 @@ public static function query_configuration($post)
<?php _e("Meta Value", UDESLY_TEXT_DOMAIN); ?>
</Help>
</Material-Input>
<Material-Select name="post_status"
options='<?php echo json_encode(self::get_post_statuses()); ?>'>
<Help>
<template v-slot:help>
<?php _e("Filter posts by post status", UDESLY_TEXT_DOMAIN); ?>
</template>
<?php _e("Post Status", UDESLY_TEXT_DOMAIN); ?>
</Help>
</Material-Select>
<Material-Select name="has_password"
options='<?php echo json_encode(self::get_has_password_options()); ?>'>
<Help>
Expand Down Expand Up @@ -393,7 +406,8 @@ public static function query_configuration($post)
"author" => [],
"meta_key" => "",
"meta_value" => "",
"has_password" => "both"
"has_password" => "both",
"post_status" => "publish"
);

$args = wp_parse_args($args, $defaults);
Expand Down Expand Up @@ -498,6 +512,20 @@ private static function get_orderby()
);
}

private static function get_post_statuses()
{
return array(
"publish" => __("Published", UDESLY_TEXT_DOMAIN),
"pending" => __("Pending review", UDESLY_TEXT_DOMAIN),
"draft" => __("Draft", UDESLY_TEXT_DOMAIN),
"auto-draft" => __("Auto Draft", UDESLY_TEXT_DOMAIN),
"future" => __("Future", UDESLY_TEXT_DOMAIN),
"private" => __("Private", UDESLY_TEXT_DOMAIN),
"thrash" => __("Trash", UDESLY_TEXT_DOMAIN),
"any" => __("Any status (not Trash and Auto Draft)", UDESLY_TEXT_DOMAIN),
);
}


private static function get_order()
{
Expand Down
4 changes: 2 additions & 2 deletions udesly-adapter-plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* Plugin Name: Udesly Adapter
* Plugin URI: https://www.udesly.com
* Description: This is a support plugin for Udesly (Webflow to WordPress converter) that allows you to enable additional features for your theme.
* Version: 2.0.0.32
* Version: 2.0.0.33
* Author: Udesly
* Author URI: https://www.udesly.com
* License: GPL-2.0+
Expand All @@ -29,7 +29,7 @@
// Constants
defined('UDESLY_ADAPTER_PLUGIN_DIRECTORY_PATH') ?: define('UDESLY_ADAPTER_PLUGIN_DIRECTORY_PATH', plugin_dir_path(__FILE__));
defined('UDESLY_ADAPTER_PLUGIN_DIRECTORY_URL') ?: define('UDESLY_ADAPTER_PLUGIN_DIRECTORY_URL', plugin_dir_url(__FILE__));
defined('UDESLY_ADAPTER_VERSION') ?: define('UDESLY_ADAPTER_VERSION', "2.0.0.32");
defined('UDESLY_ADAPTER_VERSION') ?: define('UDESLY_ADAPTER_VERSION', "2.0.0.33");
defined('UDESLY_TEXT_DOMAIN') ?: define('UDESLY_TEXT_DOMAIN', "udesly-adapter-plugin");

defined('UDESLY_ADAPTER_PLUGIN_MISC_PATH') ?: define('UDESLY_ADAPTER_PLUGIN_MISC_PATH', plugin_dir_path(__FILE__) . 'includes/misc/');
Expand Down

0 comments on commit 4833ba6

Please sign in to comment.