What is the correct way to convert the absolute path of the executing script to a URL, in WordPress?

Call get_stylesheet_directory_uri() for the current theme, or get_template_directory_uri() for the parent theme of a child theme, and append your file paths to that. $url = get_stylesheet_directory_uri() . ‘/images/my-icon.png’; $url = get_template_directory_uri() . ‘/images/my-icon.png’; Edit: To determine whether you’re in a plugin, a parent theme or a child theme, compare the folder you’re in (via dirname(__FILE__)) … Read more

How can I replace my primary url globally with a parked one?

You should change all occurences of this url in database. To do it you can: Export database to SQL Use some text editor to find&replace all occurences of http://ex-ample.com to http://example.com Import this new database to server. The other option is to use http://wordpress.org/plugins/search-and-replace/ and replace all http://ex-ample.com occurences. This article should be helpfull too: … Read more

WordPress not opening posts with only numbers if permalink is post_name

Sorry I didn’t follow up on this. You mentioned you weren’t using date archives. You can change the date archive structure to remove the conflict with /%postname%/: function wpa_change_date_structure(){ global $wp_rewrite; $wp_rewrite->date_structure=”date/%year%/%monthnum%/%day%”; } add_action( ‘init’, ‘wpa_change_date_structure’ ); So now after permalinks are flushed, date archive URLs will be prefixed with date/, so numeric postnames will … Read more

Set a custom URL for image in the Media Library?

Sharing my thoughts on multiple issues you mentioned. Hoping one or two of the following would help… Firstly, you may visit your site’s wp-admin/options-media.php and uncheck the option “Organize my uploads into month- and year-based folders” Why can it only be attached to ONE post/page? An image can be attached to any number of posts … Read more

How can I change a plugin’s URL?

For changing the slug, replace the line: ‘rewrite’ => true, at otw-portfolio-light.php inside $args = (…..); for register_post_type( ‘otw-portfolio’, $args ); with: ‘rewrite’ => array(‘slug’ => ‘new-slug’), note: this will be overridden on plugin update additional you might have to go to Dashboard > Settings > Permalinks and save to make changes appear

how to make URL link query string

This is how I got it working: ADDED this to functions.php: function include_template_function( $template_path ) { global $wp; if ($wp->request == ‘state’) { $template_path = locate_template( array ( ‘state.php’ ) ); } return $template_path; } $state_name = $_GET[‘st’]; //this is added to use as a global variable ADDED THIS to header.php because WP thinks it’s … Read more

Get posts from taxonomy URL

So I’m taking some liberties with this, I’m assuming a couple things: You know the taxonomy the term belongs to You have the term archive link So if I have the term archive link: $url=”http://www.example.com/taxonomy/term/”; I know that the last part of that url is going to be the terms slug. I can use the … Read more