Get taxonomy slug from url
I think you are looking for get_query_var $term_slug = get_query_var( ‘term’ ); $taxonomyName = get_query_var( ‘taxonomy’ ); $current_term = get_term_by( ‘slug’, $term_slug, $taxonomyName );
I think you are looking for get_query_var $term_slug = get_query_var( ‘term’ ); $taxonomyName = get_query_var( ‘taxonomy’ ); $current_term = get_term_by( ‘slug’, $term_slug, $taxonomyName );
If there were only relative URLs, what would they be relative to? A post can be viewed in several different contexts, including a feed, and a WordPress install can move into a different directory relative to root. There are issues with doing it either way, absolute URLs just give you a more concrete starting point … Read more
is there a way to update all media urls in wordpress I had a similar issue with my media files not having the correct file location after a WordPress upgrade (somehow all the media links switched to a crazy incorrect directory), so I found Upload URL and Path Enabler which was able to rewrite all … Read more
This is an old post but can’t you just use wordpress $menu and/or $submenu globals like Oleg suggested in number 2. When in doubt copy WordPress: wordpress/wp-admin/menu.php For example to add link this seems like it would work: function add_external_link_admin_submenu() { global $submenu; $permalink = admin_url( ‘edit-tags.php’ ).’?taxonomy=category’; $submenu[‘options-general.php’][] = array( ‘Manage’, ‘manage_options’, $permalink ); … Read more
Kind of depends on where you are in the WordPress environment. Plugins If you’re in a plugin, you can use plugins_url. <?php $url = plugins_url(‘css/admin.css’, __FILE__); The above will give you the path relative to the file passed into the second argument. So if you’re in the main plugin file you might get something like … Read more
1) The GUID is exactly that — a GUID. It’s used to uniquely identify the post. If you need to link to a post, then use get_permalink( $post_ID ) ($post_ID is optional) (link: get_permalink). 2) Not without a plugin, no. There’s talk of using an image shortcode for 3.1 though, or maybe 3.2. In the … Read more
You can use wp-config.php to change the site url depending on where the site is accesed from, using $_SERVER[‘REMOTE_ADDR’]. Mine has something like this: if ($_SERVER[‘REMOTE_ADDR’] == ‘127.0.0.1’ || $_SERVER[‘REMOTE_ADDR’] == ‘::1’) { // accesing site from my local server define(‘WP_SITEURL’, ‘http://localhost/mysite/’); define(‘WP_HOME’, ‘http://localhost/mysite’); } else if (strpos($_SERVER[‘REMOTE_ADDR’],’192.168.0.’) !== false) { // accesing site from … Read more
From the Codex entry for Data Validation: URLs: esc_url( $url, (array) $protocols = null ) (since 2.8) Always use esc_url when sanitizing URLs (in text nodes, attribute nodes or anywhere else). Rejects URLs that do not have one of the provided whitelisted protocols (defaulting to http, https, ftp, ftps, mailto, news, irc, gopher, nntp, feed, … Read more
You can create any structure you want for this on the permalinks settings page in the dashboard. To set it to your example of /blog/title-of-post Simply navigate to Settings -> Permalink. Select the “Custom Structure” radio button and enter blog/%postname%/ into the text field there, then hit the save changes button.
Per the OP’s answer within their question: With your help and some Googling, I put together a shortcode that returns the value of any url parameter. Here it is: //THIS IS A CUSTOM SHORTCODE TO DISPLAY A PARAMETER FROM THE URL function URLParam( $atts ) { extract( shortcode_atts( array( ‘param’ => ‘param’, ), $atts ) … Read more