Tag Info

Hot answers tagged


Use parse_url(), because it exists exactly for that reason: $path = parse_url( get_stylesheet_directory_uri(), PHP_URL_PATH ); Chris Cox’ solution will fail when the wp-content directory runs under a different domain than the rest of the site.


If your theme was developed correctly all of your assets should be stored in: /wp-content/themes/theme-name/ Simply copy your theme folder and drop it into the same location on a new site. From there you can activate it via Appearence -> Themes in your WordPress backend. If you have any plugins you need to copy over you can do the exact same thing with ...


The easiest way to do this would be to regex it. Use preg_replace() or similar to trim the output of get_site_url() from the output of get_stylesheet_directory_uri(). Edit: actually, str_replace would do the job without resorting to regex. str_replace(get_site_url(), '', get_stylesheet_directory_uri());


Here is the template layout and code for your original question. I am using wp_get_recent_posts as it gives me recent posts from the category as you wanted, if not change orderby to rand for random posts, as wp_get_recent_posts return posts by default in array form you can also have a choice to shuffle them. I checked your answer its not consistent and too ...

Only top voted, non community-wiki answers of a minimum length are eligible