Is there a way to share your Facebook Page’s stream on a WordPress page or post?

The solution is simple, you need your FB page RSS feed. To have it you can modify this simple URL: https://www.facebook.com/feeds/page.php?id=136027779805212&format=rss20 As you can see the number after ‘id=’ and before ‘&format’ is the page ID. If you don’t know how to find your page ID use this simple online service: http://findmyfacebookid.com/ Then with any … Read more

Best approach to fetch data from wp options to js file or php file

Assuming you’re not using AJAX for form submission, you can use wp_localize_script(). Here’s a simplified version: In your plugin file: function wpse105919_add_scripts(){ wp_enqueue_script( ‘myjs’, plugins_url( ‘/myjs.js’, __FILE__ ) ); wp_localize_script( ‘myjs’, ‘jsLocalizedObject’, ‘hello world’); } add_action(‘wp_enqueue_scripts’, ‘wpse105919_add_scripts’); contents of myjs.js file: alert( jsLocalizedObject ); wp_localize_script() will add a global variable called jsLocalizedObject to your document’s … Read more

How to display only subcategory

The easiest way to do this would be to use wp_list_categories instead. It has depth parameter which will do exactly what you want (you can use custom walker class, if you need different output than default one). Another way would be to write your own code (but it won’t be a beautiful one). You can … Read more

Removing customise fields during plugin uninstallation

The Plugin API has hooks for that: You can use register_deactivation_hook to run a function when the plugin is deactivated. For uninstall, you have two options. Either register_uninstall_hook or add a file called uninstall.php in your plugin folder. I would not recommend delete plugin options on plugin deactivation though, the user might not know that … Read more

Use wordpress functions in another PHP file

You must put your gallery.php in the same theme folder, where the theme’s functions.php resides. Then add a single line in functions.php: get_template_part(‘gallery’,”); It’ll include the gallery.php file into functions.php and gallery.php will behave like functions.php. So, you have to keep in mind that, functions.php file is a file for WordPress and PHP functions. So … Read more

How make a php script run only with wp-cron

WP_Cron isn’t a real cron scheduler. What it does is schedule events, mark when they should be run, and wait for page traffic. When the site is loaded, it checks to see if any of these tasks need to be run (i.e. the time they were scheduled for has passed) and runs them. So you … Read more

How to save post change url youtube link?

I think you want to change default video width. You can change default embed video width and height by embed_defaults filter. add_filter(’embed_defaults’, ‘ravs_embed_defaults’); function ravs_embed_defaults($embed_size) { if (is_single()) { // Conditionally set max height and width $embed_size[‘width’] = 640; $embed_size[‘height’] = 600; } else { // Default values $embed_size[‘width’] = 460; $embed_size[‘height’] = 600; } … Read more