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

Embed php code in custom field of a plugin [closed]

Looking at the Other Notes of the plugin, you can use one of the variables to insert the post url. $post_url – Replaced with the URL of the post which was published Edit: You would just add the $post_url variable within your body field. <a href=”https://wordpress.stackexchange.com/questions/226286/$post_url”>$title</a>

Plugin update warning

Not possible unless you plan in advance in your plugin for such a possibility. And even if it was somehow possible you are still not likely to have any user read the message and actually understand it. A more realistic approach is to do a two steps upgrade, in the first vesion of your plugin … Read more

$wpdb selects wrong database

$_SERVER[‘DOCUMENT_ROOT’]; is not going to include secondsite. So all the files, including wp-config.php with the database details, are coming from the root public directory. To get the current directory, including subdirectories, use any of these: getcwd(); dirname(__FILE__); basename(__DIR__); But if your file is in a deeper folder, you can’t find the secondsite directory without specifying … Read more

How is this sliding/scrolling navigation made?

That sliding navigation is a feature built-in to the theme used by the Thinking for a Living website. If you view the source code, you can see that each panel in the slider is defined by similar code starting with: <div id=”covers” scope=”Covers”> <div class=”cover-index grid4 column page”> <div class=”cover grid3 cover-quote”> … A quick … Read more