WP_PLUGIN_URL equivalent

WordPress is expecting http, but you’re visiting with https which is causing the mixed content error. Setting your site and address URLs to use https should solve your problem. If you can’t use https in the admin, then you’ll need to try ways to tell WordPress to use https only on the frontend. Try something … Read more

Automatic short URL in posts

I installed yourls on a custom short domain. Then added an acf field to posts. Then when a post is added or modified, call yourls API to get the shortlink, and save that link in the custom field add_action(‘acf/save_post’, ‘update_related_posts’, 20); function update_related_posts($post_id) { global $old_field_value; // Check if the save is an auto-save, in … Read more

Change from blogger to wordpress

You can use the same custom domain for WordPress blog. Steps to follow (if you want to go with self hosted WordPress): First purchased a hosting for WordPress from any hosting company. Install WordPress on temporary URL provided in hosting account. Import all the posts and comments from blogger.com blog by using default imported tool … Read more

How to make a rest style plugin?

I got a little piece of code here, but it should/could probably be improved. Create new query_vars Create new rewrite rule Redirect to specific template which then handles your parameters Create new query vars function register_gallery_query_vars($vars) { $vars[] = ‘gallery_id’; $vars[] = ‘image_id’; return $vars; } add_filter(‘query_vars’, ‘register_gallery_query_vars’); Add rewrite rule function custom_rewrite_gallery() { add_rewrite_rule(‘^gallery/([0-9]+)/([0-9]+)/?’, … Read more

How to use plugins_url() inside PHP stylesheet file [duplicate]

Try background:url(<?php echo plugins_url().’/myimgfolder/my_img.png’; ?>) no-repeat <?php echo $x_position.’ ‘.$y_position; ?>; It will allow you to echo the PHP elements into your style. EDIT: You also need to close the file, you’re trying to mix unwrapped PHP with your CSS. Your PHP variables aren’t escaped either. I’ve tested the code below, and it works fine: … Read more

add custom entries to menu options

Here a very quick example. The idea is to add a new meta box in the menu configuration. add_meta_box is used in admin_head-nav-menus.php page: class Custom_Nav { function __construct() { add_action( ‘admin_head-nav-menus.php’, array( $this, ‘add_nav_menu_meta_boxes’ ) ); } public function add_nav_menu_meta_boxes() { add_meta_box( ‘custom_links’, __(‘Custom links’), array( $this, ‘nav_menu_link’), ‘nav-menus’, ‘side’, ‘low’ ); } public … Read more

tech