wordpress-theming

Wordpress - Show parent category AND subcategory name in subcategory archive URL

倖福魔咒の 提交于 2019-11-30 12:44:58
I'm having some trouble with Wordpress category/subcategory archive URLs. For example, I want to be able to display this archive: http://faroutmagazine.co.uk/wp/track-of-the-day while keeping its parent category in the URL, making it http://faroutmagazine.co.uk/wp/music/track-of-the-day Previously, I was just getting a "This is embarrassing..." 404 message when accessing the /music/track-of-the-day URL (even though that's the one that was appearing in the View option under categories in the admin section of WP). Now the View link in the admin area only shows me the /track-of-the-day URL, and

Adding a jQuery script to wordpress Admin

≡放荡痞女 提交于 2019-11-30 06:33:19
I cannot for some reason get the wordpress /wp-admin pages to execute a simple query file. It only works if i deregister jquery in my functions.php within my theme folder, but then i must re-register all the jquery.ui files separately which is tedious. Im using wordpress 3.0 multisite installation. I'm trying not to touch the core wp files. It will show in the source and links to the file ok but won't execute the script. heres what i have in my functions.php: function my_script() { if (!is_admin()) { wp_deregister_script('jquery'); wp_register_script('jquery', 'https://ajax.googleapis.com/ajax

Exclude the_post_thumbnail from gallery shortcode

匆匆过客 提交于 2019-11-30 05:37:19
I am using this code to have a simple gallery on the page: <?php echo do_shortcode('[gallery itemtag="ul" icontag="li" size="full" columns="0" link="file" ]'); ?> The problem now is that the end-user has to upload an image via the Media page before selecting this image as featured image. I know this could be solved by adding the featured image's ID to the shortcode's exclude list, but how to get this ID automatically? function exclude_thumbnail_from_gallery($null, $attr) { if (!$thumbnail_ID = get_post_thumbnail_id()) return $null; // no point carrying on if no thumbnail ID // temporarily

How to add custom post type archive to menu

℡╲_俬逩灬. 提交于 2019-11-30 04:55:26
I have been searching for weeks and I still haven't found a proper solution to this problem. I am writing a Wordpress Theme. I have a custom post type called Works. I would like to add my Works archive to my menu and have it as well as it's posts highlighted when I access them. I can access my archive and posts on the following links Works archive: /works/ Works single post: /works/postname/ My solution so fare have been to name my archive-works.php template file with a template name (Work archive). Then create an empty page using that template and adding the page to the menu. This highlights

How to update user meta for multiple meta_key in wordpress

不羁的心 提交于 2019-11-30 04:55:25
问题 I'm trying to update multiple meta_key for user in WordPress update_user_meta( $user_id, array( 'nickname' => $userFirstName, 'first_name' => $userFirstName, 'last_name' => $userLastName , 'city' => $userCityID , 'gender' => $userGenderID) ); but it is not working. How can we update multiple meta_key for user? 回答1: Try: <?php $user_id = 1234; $metas = array( 'nickname' => $userFirstName, 'first_name' => $userFirstName, 'last_name' => $userLastName , 'city' => $userCityID , 'gender' =>

Custom post status not appearing

喜夏-厌秋 提交于 2019-11-30 04:43:44
问题 I am building a directory theme for a client of mine, and I like to add the feature of expiration in the posts by modifying the post status from publish to expired. To achieve that, I am trying to register a new post status by using the following code: add_action('init', 'registerStatus', 0); function registerStatus() { $args = array( 'label' => _x('Expired', 'Status General Name', 'z' ), 'label_count' => _n_noop('Expired (%s)', 'Expired (%s)', 'z'), 'public' => true, 'show_in_admin_all_list'

Apply CSS Repeatedly to Specific Words

删除回忆录丶 提交于 2019-11-29 15:53:53
I'm trying to apply CSS repeatedly and automatically to specific words. For example, for the word "Twitter" I want the colour of the text to be #00ACED. At present I am manually applying these colours around specific brand terms using span classes: <span class="twitter">Twitter</span> With the CSS: .twitter { color: #00ACED; } However, this is a process and I would prefer a method which completes this styling automatically. I have about 20 brand words with an associated colour styling. Can anyone assist me with this problem. I am using WordPress if that makes any difference. Something like

WP: how to remove version number in wp_enqueue_script?

久未见 提交于 2019-11-29 15:05:22
I'm trying to remove the version number from appearing in the URL generated by wp_enqueue_script . It seems like I should pass a null on the 4th parameter per http://codex.wordpress.org/Function_Reference/wp_enqueue_script : wp_enqueue_script('jquery', false, array(), null, false); It's not working. I still see the version number. How do I remove that? Also, how do I use wp_enqueue_script so that I get jQuery from the Google CDN? You can either use wp_enqueue_script('jquery', 'URL', array(), '', false); or wp_enqueue_script('jquery', 'URL', array(), null, false); or you can put a generic name

How do I get the name of the file that is being used to render the current page?

a 夏天 提交于 2019-11-29 13:52:06
Let's say I have a WordPress installation, with a page named "About". If I go to http://example.com/about , I know from WordPress' template hierarchy page that I'm looking at the theme file page.php . I'm wondering if there's a way to display that fact (for theme debugging) on the page somewhere? Like what function (or code) would I call to display the current PHP page that is being used to render the page I'm looking at. I could do something with $_SERVER['PHP_SELF'] , but I'm looking for a way where I don't have to edit every PHP file. Like something that spits out the list of files it's

jquery and wordpress

≯℡__Kan透↙ 提交于 2019-11-29 12:37:29
i am having difficulty making my jquery functions operate within wordpress. can anyone help out with why these should work normally but not in wordpress??? It seems like you have to load the script using wp_enque_script . You can find the documentation for this function and for loading scripts in WordPress in general at the codex page for wp_enque_script . Furthermore, I found an article on Using jQuery with WordPress that provides sample code for the loading of the script and then the use of it. If you look at the Codex documentation, it says: The jQuery library included with Wordpress loads