johnkelton
Forum Replies Created
-
Forum: Plugins
In reply to: [WP Mobile Menu - The Mobile-Friendly Responsive Menu] How to add shortcode?You are awesome! Thanks a lot for supporting your plugin and its users! 🙂
- This reply was modified 7 years, 5 months ago by johnkelton.
Forum: Plugins
In reply to: [WP Mobile Menu - The Mobile-Friendly Responsive Menu] How to add shortcode?How can I hard code embed shortcode in the menu? Your plugin is great but I just need this shortcode thing working.
- This reply was modified 7 years, 5 months ago by johnkelton.
Forum: Plugins
In reply to: [WP Mobile Menu - The Mobile-Friendly Responsive Menu] How to add shortcode?Thanks for your reply. But the method you suggested didnt work at all.
Forum: Developing with WordPress
In reply to: Finding Posts with Same title and then Edit themThanks a lot for your help!
Forum: Developing with WordPress
In reply to: Finding Posts with Same title and then Edit themwhen I did this:
'posts_per_page'=> 2, //Added 2 instead of 1 ); $the_query = new WP_Query( $args ); if ( 2 == $the_query->post_count ) { // two identical posts $content .= "[custom-trick id={$the_query->posts[1]->ID}]";//index = 1
this seems to be working, what you think?
- This reply was modified 7 years, 8 months ago by johnkelton.
Forum: Developing with WordPress
In reply to: Finding Posts with Same title and then Edit themOk Problemo:
It doing everything right, except, it had the same ID in both shortcodes , this id is of the newly created and published post
First shortcode whould have the ID of Matched Post and Second Shortcode should have the ID of this new published post
[custom-trick id=342][custom-trick id=342]
It should be
[custom-trick id=234][custom-trick id=342]
- This reply was modified 7 years, 8 months ago by johnkelton.
Forum: Developing with WordPress
In reply to: Finding Posts with Same title and then Edit themlets see, I am trying now, stay tuned!
Forum: Developing with WordPress
In reply to: Finding Posts with Same title and then Edit themIf your snippet is all what I need then I dont see how will it just do:
[custom-trick id=234] for a custom-post with unique title
VS
[custom-trick id=234][custom-trick id=342] for a custom post-post with duplicate title
Forum: Developing with WordPress
In reply to: Finding Posts with Same title and then Edit themOk, so I will add this to my existing code?
LIke:function update_post_content( $ID, $post ) { if (get_post_meta($ID, "first_time_published", false)) { return; } $my_post = array( 'ID' => $ID, 'post_content' => "[custom-trick id=$ID]", ); update_post_meta($ID, "first_time_published", true); wp_update_post($my_post); $args = array( 'title'=> $post->post_title, 'post_type'=>'my_post_type', 'posts_per_page'=> 1, ); $the_query = new WP_Query( $args ); if ( 1 == $the_query->post_count ) { $content .= "[custom-trick id={$the_query->posts[0]->ID}]"; } } add_action( 'publish_custom-trick', 'update_post_content', 10, 2 );Forum: Developing with WordPress
In reply to: Finding Posts with Same title and then Edit themThanks a lot for your help. It does point me to right direction; since I am new to php I am finding it hard to convert the pseudo code. I read the document you pointed me to but I am still in no clue land. Any advance help is much appreciated!
Forum: Fixing WordPress
In reply to: How to auto add short code to content?if you can show me an example code.
Forum: Fixing WordPress
In reply to: How to auto add short code to content?I am new to wordpress and php. I would really appreciate your help.