Doing action based on input from options menu

You should post to the same URL and catch the submit ex: function option_page_html(){ if (isset($_POST[‘plugin_action’]) && $_POST[‘plugin_action’] == ‘post_url’){ include_once(plugin_dir_path(__FILE__).’post-video.php’); } ?> <div> <form action=”” method=”post”> <p><h3>Paste video url</h3></p> <input type=”text” size=”100″ name=”url” /><br/> <input type=”hidden” name=”plugin_action” value=”post_url”> <input type=”submit” value=”Post”/> </form> </div> <?php } note : this is an example and you should … Read more

Display wordpress post to static website in the footer

EDIT After a brief chat with Original Poster, the following solution works: Install the Magpie RSS library. Create a folder in the root directory of raminusa.com, name it magpierss Upload 4 files (*rss_fetch.inc*, *rss_parser.inc*, *rss_cache.inc*, and *rss_utils.inc*), and the directory extlib to this new folder In the footer script of raminusa.com (which should be in … Read more

Amending PHP for WordPress Theme

You probably want to amend this line: $wp_query->query(‘post_type=product&paged=’.$paged); To include some more limitations, like &department=Featured. I’m unaware of your whole project’s code structure, so I can’t advise exactly what you’d need to put.

Execute PHP code in Javascript onclick

In simple terms, window.location.href is javascript, and will run in the browser, but PHP runs on the server. In order to execute update_usermeta() you need to open a page with that block of code on it. The best way to do this from a click is to use AJAX (javascript) to visit the URL on … Read more

How do I add php to all links automatically?

Inserting PHP is not really the way you want to do this. You would then need additional code to execute the PHP in the post body. It could be complicated. Replace the links using a filter on the_content. Something like this: function replace_urls_wpse_91463($matches) { $ret=”<a”; if (isset($matches[1])) { $ret .= $matches[1]; } if (isset($matches[2])) { … Read more

Password form redirection to belonging post

Here is all you need to make this work, plus your actual form of course: function dopasswordstuff(){ if(isset($_POST[‘homepagepassword’])){ global $wpdb; $post_password = trim($_POST[‘passwordfield’]); $post_id = $wpdb->get_var( $wpdb->prepare(“SELECT ID FROM $wpdb->posts WHERE post_password = %s”, $post_password) ); if (!empty($post_id)) { wp_redirect(get_permalink($post_id)); } exit; } } add_action(‘template_redirect’,’dopasswordstuff’); I simplified your function considerably by leveraging the fact that … Read more