Wordpress user frontend Plugin Posts listing order by title? - wordpress

We are using "Wordpress user frontend Plugin" in our site to create, edit posts from frontend.
There we need a feature which is not implemented in the plugin we guess.
We need to show the posts listing by their titles regardless of their creation date.
Can it be possible?if yes, then can please let us know the correct way of using an action hook or filter rather than made the changes directly on the plugin files itself.
Really needed a quick response,already spending a lot of hours for this one.
Thanks,

You'll need to edit the index page, including 'orderby'=> 'title' in the correct place.
A quick google search will find the exact answer you need. Do your research.

finally after going through the plugin(Wordpress user frontend) files.
I got this filter "wpuf_dashboard_query".
applied my necessary changes to it and it worked.
add_filter('wpuf_dashboard_query','wpuf_posts_sort_by_title');
function wpuf_posts_sort_by_title($args){
$data = array_merge($args, array('orderby'=> 'title', 'order' => 'DESC'));
return $data;
}

Related

can I have different url for custom post type in frontend and backend?

The question is straightforward. I have custom post type 'project'. In front-end for the project detail page I don't want 'project' to show in url. I mean by default project detail default url will be site_url/project/project_url but I want new url to be site_url/project_url.
I tried
'rewrite' => array(
'slug' => '',
'with_front' => false,
),
but this cause url to be changed in both backend and frontend and also page named "Projects" is throwing 404 error.
Can this be done ? Any suggestions or help is welcome.
I tried to achieve it without using any plugin but I failed. So I used plugin 'https://wordpress.org/plugins/permalink-manager/' and it helped me achieve what I wanted.
Following my comments, in short, it's not the intended initial behaviour Wordpress had in mind. Only posts or page are supposed to display that behaviour. I've just made a couple of test. None of the answer properly works, as they all have impacts on some crucial functionality.
If you're not using single-cpt.php then the accepted answer could worked for you (eg: https://wordpress.stackexchange.com/a/204210/190376) but then again I would suggest you avoid messing up the default permalinks structure.
In any cases, none of the example are talking about flushing rewrite rules upon modify the permalinks structure. Do your tests, tests all answers given in that post (eg: https://wordpress.stackexchange.com/questions/203951/), and add the following to the top of your function.php file.
<?php
/**
* flush_rewrite_rules
* Remove rewrite rules and then recreate rewrite rules.
* #link https://developer.wordpress.org/reference/functions/flush_rewrite_rules/
* Need to be removed before pushing to live.
* Can be replaced on live by: add_action( 'after_switch_theme', 'flush_rewrite_rules' );
*/
flush_rewrite_rules(); ?>
Making sure you're flushing every time is the only way to make sure your testing is accurate.

Wordpress Woocommerce plugin mail triggering

Mail not sending when status changed from processing to on-hold and processing to failed.
Kindly tell me how to achieve this. Thanks in advance
Even that kind of questions (directly asking the need without any research or any part of code) are not welcomed here, I want to help you about that by giving the basic idea.
In the file "wp-content/plugins/woocommerce/includes/class-wc-emails.php", search for the "public static function init_transactional_emails()" and check "$email_actions" array there.
$email_actions = apply_filters(
'woocommerce_email_actions', array(
'woocommerce_low_stock',
'woocommerce_no_stock',
'woocommerce_product_on_backorder',
'woocommerce_order_status_pending_to_processing',
'woocommerce_order_status_pending_to_completed',
'woocommerce_order_status_processing_to_cancelled',
'woocommerce_order_status_pending_to_failed',
'woocommerce_order_status_pending_to_on-hold',
'woocommerce_order_status_failed_to_processing',
'woocommerce_order_status_failed_to_completed',
'woocommerce_order_status_failed_to_on-hold',
'woocommerce_order_status_on-hold_to_processing',
'woocommerce_order_status_on-hold_to_cancelled',
'woocommerce_order_status_on-hold_to_failed',
'woocommerce_order_status_completed',
'woocommerce_order_fully_refunded',
'woocommerce_order_partially_refunded',
'woocommerce_new_customer_note',
'woocommerce_created_customer',
)
);
Since after every update of Woocommerce plugin any changes you made on those files will be gone, you need to add your email trigger for status changes you mentioned by either using a hook or overriding the files using your child theme.
About your request, for "from processing to on-hold" you need to add:
'woocommerce_order_status_processing_to_on-hold',
About overriding a file (or function) from includes folder of Woocommerce you may check this post: Override woocommerce files from includes folder
I hope this will help you to solve it. Have a good day.

Wordpress post to user relation ship

Is there any way to connect post to specific user in wordpress. Is there any plugin available. Or any one know the code for doing that.I have a custom post type stories. When adding stories i need to chose the corresponding users from user list. Please help
Install Post2post https://wordpress.org/plugins/posts-to-posts/
Then in your function.php write this code
p2p_register_connection_type ( array(
'name' => 'releated_user',
'from' => 'story',
'to' => 'user'
) );
here story is your custom post type slug. related_user is just a connection name.You can name it as what you like.
Then in your post type section you can see an option for selecting corresponding user.
In the custom post type setup, you first need to ensure that this post type allows for authors to be set.
This comes in from the arguments when registering the post type.
$args = array('supports'=>array('author'=>true));
If you have an admin account, you can set who the author is using the quick edit function or by allowing to see it under screen options on the full edit page.
Other than that, you can make your own complete post meta box to allow for multiple authors. I cant see a plugin on the wordpress plugin directory so creating your own to fit your needs and wants will be your best bet.

wordpress - Issue With custom post types and permalinks

I'm working with Custom Post Types for the first time and running into a vexing problem:
I can add and query the post types, but they always show up as:
domain.com/post-type-name/post-title
I have no rewrite in place, and my permalink structure is set to %postname% only, and I am flushing the rules immediately following adding the post type.
Any ideas on what I'm doing wrong?
This could be helpful to solve the problem:
http://www.ultimatewebtips.com/remove-slug-from-custom-post-type/
You may try two things
Just visit your Permalink Settings from the settings menu and save the page again.
or you may try
register_post_type('post-type-name', array(
//...
'rewrite' => array('slug'=>'','with_front'=>false),
//...
));

Change management in WordPress

I have a beginner question. What is the best way to address the change management issues in WordPress? I have an all-pages WordPress installation. Suppose name of some event or an entity changes from A to B, then I have to go to all the pages to make that change. Is there any better way of doing it? Like externalization or something.
Or the way similar to how WordPress handle blog name using bloginfo() function. You change blog name at one place and it is reflected everywhere.
Thanks,
Paras
If a URL on your site changes, it is always wise to leave a redirect to the new page. This will help your visitors and search engines. If you create redirects, it doesn't matter too much if you still have a link to the old address in one of your posts. There will probably be a plugin for this, but I don't know which one.
If you really want to keep all links pointing to the latest version, you could replace them with shortcodes that are evaluated to the real URL. <a href="[linkto postid=123]"> would then result in <a href="/2010/08/05/some-post">. I think this is doable, but I don't know whether a plugin already exists for this.
You can also use this technique to replace short snippets, like your company name. The Shortcode API is really easy:
// [company_name]
function replace_company_name($atts) {
return "My Awesome Company";
}
add_shortcode('company_name', 'replace_company_name');
// More generic
// [replace r='company_name']
// [replace r='company_motto']
function do_replacement($atts) {
$replacements = array(
'company_name' => 'My Awesome Company',
'company_motto' => 'A Company so Awesome even you would want to work here!',
);
return $replacements[$atts['r']];
}
add_shortcode('replace', 'do_replacement');
You can hardcode the strings in your plugin code, or you could create a Wordpress options page where users can add and edit new shortcodes.

Resources