question stringlengths 0 34.8k | answer stringlengths 0 28.3k | title stringlengths 7 150 | forum_tag stringclasses 12
values |
|---|---|---|---|
I am involved in a large migration from another CMS to WordPress. We have a copy of the database and have worked out how to extract the content and programmatically create WordPress posts from it using an instantiation of the <code> wpdb </code> class. However, there are a couple of thousand images which we would like ... | There's actually a great function that will do all three of those things for you: <code> media_sideload_image( $url, $post_id, $description ); </code> The first argument is the remote url of the image you want to download. The second argument is the post id of the post to which you want to attach the image. The third a... | Programmatically get images by URL and save in uploads folder | wordpress |
I am wondering how can I write a conditional tag that affects a custom taxonomy slug and its children? Found this in Wordpress Codex: <code> is_tax( 'flavor', 'mild') </code> When the archive page for the flavor taxonomy with the slug of 'mild' is being displayed. However with this code only 'mild' slug archive page is... | I have a handy little function that i based on post_is_in_descendant_category function it expends the is_tax to check if its the term or any of his children <code> function is_or_descendant_tax( $terms,$taxonomy){ if (is_tax($taxonomy, $terms)){ return true; } foreach ( (array) $terms as $term ) { // get_term_children(... | Conditional tag affecting taxonomy term and its children? | wordpress |
I've been looking into setting up a WordPress network install. Everything has been going pretty smoothly until I get to the point where my desired domain layout doesn't fit well. I would like to have a layout as follows: blog.*.stackexchange.com so for example, I would like to have multiple sites in a network that look... | You could use the Domain Mapper plugin for this. Drawback being that you'd have manually configure each subblog. | Setting up a wordpress network with third level domains | wordpress |
I am using the MidMo Clean theme and for some reason the 404 error page isn't working. Parse error: syntax error, unexpected T_STRING in /home/wpversec/public_html/UXJobsLA.com/wp-content/themes/clean-home/404.php on line 14 http://uxjobsla.com/error Short of me disabling all my plugins and re-installing a out of the b... | So I think you're problem is the quotes in the href inside your function. Try escaping them like this and it should be fixed. <code> <p><?php _e("Sorry but, you are looking for something that isn't here. <br /><br /> Looking for more web developer jobs, please visit our sister site: <a href=\"ht... | How to fix 404 page error on theme | wordpress |
I had some code in a template file. When I pasted it from the backend's post panel (HTML tab) as a post, and retrieved it as custom loop, the code didn't output well. Any suggestions? Adding them as posts: <code> <?php /** * Template Name: Lyrics Page * @package WordPress * @subpackage Prominent * @since Prominent 1... | Finally, figured out, I needed this: <code> remove_filter('the_content', 'wpautop'); </code> | Adding some HTMl code as posts doesn't work but it does if it is added directly in the file? | wordpress |
Is there a way to limit how many pages a user can make inside a custom post type? This would be pretty effective for commercial WP plugins and I am making one, but have come across a little problem and I would need to figure out how to do this. Thanks. | Check out my plugin Bainternet Posts Creation Limits this plugin helps you to limit the number of posts/pages/custom post types each user can create on your site. Its just what you need. Update open up bapl.php and in bapl_limit_post_count function change on line 44: <code> if ( current_user_can('manage_options') ) {}e... | Limit Amount of Pages users can create in Custom Post Types | wordpress |
I've been looking for a chat support plugin for WP and I haven't been able to find one, does anyone know about one? Free or paid doesn't matter. Thanks in advance. | If you're looking for a "talk with a representative" type chat plugin I found that www.oggchat.com was a reasonable one, and they have a Wordpress plugin to go with it. It supports the rep chatting from either the Oggchat website or via Gtalk, so your rep could be anywhere at any time, with a smartphone and a Gtalk pro... | Chat support plugin? | wordpress |
I've been racking my brains for the best way to create a simple gallery in Wordpress without relying on a plugin like NextGen gallery, and was thinking a shortcode would be a good way combined with the in-built method of 'attaching' images to a post. That way, the user would 'attach' images they've uploaded and the des... | You won't be able to do it purely with Javascript (with or without jQuery) as the images are hosted server-side, and there'd be no way for a Javascript function to scan to see what's available. What you could do is write a function to do it in functions.php and tie it to a shortcode, but then you're starting to get int... | Making jQuery-based galleries with Wordpress without a plugin? | wordpress |
It's possible that I'm just doing this wrong, so feel free to let me know how you would solve this problem. I have a mostly page-based site, but there are a few "pages" where my content is coming from a custom <code> query_posts() </code> call. In all of these pages I want to be able to use <code> wp_list_pages() </cod... | This is for future askers, Whenever you use query_posts or custom wp_query you should add wp_reset_query(); after your loop or when you are done processing your posts. This little line of code will help in solving pagination issues or in your case rest the global $post the original as before your query. | Using wp_list_pages() after calling query_posts() | wordpress |
If you use the <code> [gallery] </code> tag at all you know that permalinks for image attachments end up like <code> blog.com/2011/03/18/post-permalink/attachment-permalink </code> . The URL extension from the post permalink appears to be based on the attachment's title on first save. To my knowledge, however, this per... | This'll add a slug field to the edit attachment page, which'll allow you to independently change it when and how you choose to. Drop it into a plugin or your theme's <code> functions.php </code> ; <code> function __edit_attachment_name( $fields, $post ) { $fields['post_name'] = array( 'label' => __('Slug'), 'value' ... | Is there a user-facing interface to edit an attachment's permalink? | wordpress |
I'm working on a plugin to will retrieve data from a remote server and display it on the Dashboard. To do this, I'll be using the WordPress HTTP API but I'm not seeing any information on the HTTP API using any form of caching. As I don't want my plugin to cause problems for the admins of the remote server, I was wonder... | It does not. Some functionality actively uses HTTP API and is cached - feed fetching, updates checking. But caching is always implemented at wrapper's level. Making HTTP request without context is too unspecific to make educated guess about caching needs (one minute or one hour). | Does WordPress's HTTP API use any caching? | wordpress |
I'm deploying a multi-site network, using subfolders. I've found on the main site the permalinks for news posts can only be placed like so: <code> /blog/%year%/%monthnum%/%postname%/ </code> I understand that this prefix is needed to lessen the risk of conflict between the main site and sub-sites. Unfortunately this is... | Let see if I remember this correctly. Go to http://yoursite.com/wp-admin/options.php Find <code> permalink_structure </code> . By default, the value should be <code> /blog/%year%/%monthnum%/%postname%/ </code> Change the value manually to whatever value you like. e.g <code> /pressreleases/%year%/%monthnum%/%postname%/ ... | Multi-site: removing /blog from posts | wordpress |
I recently started working with a client who has over 400 pages on their WP site (yes, pages, not posts). Their menu needs to be redone, so I decided to go the 'custom menus' route. However, not more than a third of the pages are available to select from the 'Pages' meta box on the Menus page. And 'search' does not see... | Upgraded to 3.1 from 3.05 and both problems (inability to see all pages in 'pages' box, and inability to search) went away. | Is there a limit to number of pages displayed for selection in custom menu? | wordpress |
I would really appreciate if you could help me :) I'm very stuck and don't know how to proceed. I have a custom post type called <code> event </code> and 2 custom taxonomies registered for it: <code> event_type </code> with tag-like functionality (ex. of event type: yoga, voice work) <code> event_location </code> with ... | I got a bit confused with this one. At the end I've decided not to group the events by <code> event_location </code> category and simplify the functionality. What I have done instead is the following: I detect what <code> event_type </code> events to display by looking at a URL. Then I display all the events of that <c... | how to group custom post type posts by custom taxonomy terms | wordpress |
I'm having a very hard time implementing post formats in my Thematic child theme. I am able to add post format theme support and add content via the big conditional statement, but the <code> .format-video </code> , etc. selectors do not appear in the post class so I can' use them to style the formats. According to some... | Okay, I'm going on the assumption that the real question is "how do I get Thematic to add the post-format to its body classes?" Try this in your functions.php: <code> function my_thematic_post_format_class( $classes = array() ) { $format = get_post_format(); if ( '' == $format ) $format = 'standard'; $classes[] = 'form... | Post format selector in Thematic child theme post class | wordpress |
After you have uploaded an attachment in Wordpress using the media upload screen, is there a hook or filter I can run after the image has been uploaded where I can get the path to the uploaded image so I can analyse it? I am building a plugin that will analyse an image after it has been uploaded and then tag the image ... | Turns out I solved my own question with help from a colleague. The two filters that get called after media is uploaded or when media is being edited are; 'add_attachment' and 'edit_attachment'. Here is the code I am using, I then check to see if the attachment is an image (code omitted from example). <code> function an... | Getting Path To Uploaded Attachment Image After Upload | wordpress |
I am looking into updating this template ( http://templatic.com/demos/answers/?ptype=ask-a-question ) which allows logged in subscribers to post (questions). I would like to add an option to upload a file and attach it to the post. I was thinking of using the media-upload functionality, but I do not want to give users ... | You won't find much on the Codex or the net about this. Media can seem like a pretty dark art, but everything you're looking for is in /wp-admin/includes/media.php . The function you're looking for is <code> media_handle_sideload() </code> . You'll have to pass it a <code> $file_array </code> , which you'll have to rea... | How can I to add upload functionality outside of the admin area? | wordpress |
What codex/query would I use to call a list of pages with a specific tag from within another page? | Probabbly the easest way to do it is use: Kalin's Post List Creates a shortcode or PHP snippet for inserting dynamic, highly customizable lists of posts or pages such as related posts or table of contents into your post content or theme. so you can either use a shortcode or edit your theme file. | Display list of posts with x tag within a page? | wordpress |
Take a look at this post: http://mikewills.me/blog/links-for-2011-02-24/ My images are broke and CSS links are broke. I know the problem is with the permalink, but why would it be broke? I have the same problem with the Twenty Ten theme and the new Twenty Ten Five theme. | Viewing your pagesource and clicking on your first style sheet link brings up this error: <code> <html> <head> <title>Not Found</title> </head> <body> <h1>Apache server with mod_pagespeed</h1> OK <hr> NOT FOUND:http://mikewills.me/blog/links-for-2011-02-24/ wp-conte... | Template messed up on viewing posts | wordpress |
I have a script that loads jQuery when an element comes into the viewport, as discovered by Javascript (without a library), and it looks like this: viewport.js: <code> var height = 0; if( typeof( window.innerWidth ) == 'number' ) { //Non-IE height = window.innerHeight; } else if ( document.documentElement && ( ... | It would seem that something in Wordpress causes a virtual revert to a standards that require cross-browser compatibility, making the same code not work inside and outside Wordpress. However, with some code to handle browser-differences (and still avoiding using libraries), the following is what viewport.js looks like ... | Document.body.scrollTop in Wordpress | wordpress |
Let's say theme 1.0 is installed with 30 files in it. Then two weeks later theme is upgraded to theme 2.0 which contains only 10 files. Do those older 20 files get automatically deleted after upgrade? What I wanted to do is to place a file inside the theme directory, trough which the user can customize the theme. This ... | Yes. Find a theme that support Child Theme . Create a child theme so that your modification doesn't get deleted if you update the parent theme. | Does WP delete deprecated plugin/theme files on plugin/theme upgrade? | wordpress |
I'm just doing some wordpress development and wondered for a brand new install, which code within core is generating the first value that get's filled into the <code> home </code> option? I'm looking for the code in core, e.g. the filename and the line where this happens. Does someone remembers from mind? | When the installer runs it calls <code> wp_install() </code> , that in turn calls <code> populate_options() </code> defined in <code> wp-admin/includes/schema.php </code> , which runs the following.. <code> if ( !__get_option('home') ) update_option('home', $guessurl); </code> Prior to that <code> $guessurl </code> is ... | On Install, which code sets the 'home' option? | wordpress |
I find it very unnecessary to have an "add image" button that brings me to yet another screen that will let me upload content to my post. Ideally I would like to have a meta box with the option to add images directly in a meta box. I managed to get some functionality by copy the source for the media-upload form and pas... | As Apple might've put it " There's a plugin for that " :) ( Faster Image Insert ) | Put the media uploader in a metabox | wordpress |
I've got problems getting pretty permalinks to work. When changing the permalinks (e.g. to month/name), my .htaccess (in the wordpress directory - there is another one one level up) is changed like this: <code> AddType x-mapp-php5 .php AddHandler x-mapp-php5 .php # BEGIN WordPress <IfModule mod_rewrite.c> Rewrite... | I've finally managed to track down the cause of the problem .. it was a Plugin that seems to have issues (Top Level Categories). I've looked into their documentation, but there is no indication that I would run into that problem. Hmmmm ... At least it's working now! | Problems redirecting to "pretty" permalinks (wordpress in Subdirectory) | wordpress |
I will like to implement a few of the boilerplate template features in one of my instance WordPress. I am trying to figure out how to exchange the regular jquery calls below <code> <script type='text/javascript' src='http:/.../wp-includes/js/jquery/jquery.js?ver=1.4.4'></script> <script type='text/javasc... | You should be loading jQuery with <code> wp_enqueue_script('jquery') </code> - that way, you won't end up with multiple instances if plugins try to load it too. To use Google CDN, place this in your <code> functions.php </code> ; <code> wp_deregister_script('jquery'); wp_register_script('jquery', 'http://ajax.googleapi... | How to replace regular jquery calls with CDN calls from Google? | wordpress |
Specifically, I'm talking about the following which gets added automatically: 1) <code> <script type='text/javascript' src='http://mysite.com/wp-includes/js/l10n.js?ver=20101110'></script> </code> 2) <code> <script type="text/javascript"> //<![CDATA[ var _wpcf7 = { cached: 1 }; //]]> </script... | 1) Normally not (that's the translation mechanism offered for javscript strings), but you can probably de-register that l10n script. But be warned that some plugins and the site might not work as intended any longer. 2) Yes, by uninstalling the contact form 7 plugin. 3) Yes, by removing the disqus plugin. 4) If disabli... | removing wordpress generated code from the head section? | wordpress |
Is it possible to add a short description to a custom taxonomy's admin area? For example, I've added a taxonomy that determines what kind of banners are displayed on a post's page. In the meta box for this taxonomy on the Edit/Add Post page I'd like to add a little blurb explaining how it works. | I don't know of any hooks to add or filter the metabox so you can either create your own metabox to replace the custom taxonomy metabox or in this case just use JQuery <code> .append() </code> for example is your taxonomy is named banners and its none - hierarchical (like tags) then: <code> $('.tagsdiv-banners').append... | Custom taxonomy admin description | wordpress |
Hi is it possible to modify the login fields required to login into wp-admin? Say to use the email address instead of the username together with the password to gain access. How would I go about doing that? thanks | There are plugins which help to do this: With http://wordpress.org/extend/plugins/wp-email-login/ people can use their email address instead of their username to log into you WordPress install. Using http://wordpress.org/extend/plugins/theme-my-login/ you can have the WordPress login included in your design, and allow ... | Modify WP-Admin login fields | wordpress |
I spent almost an hour searching why my sidebar here: http://www.r-bloggers.com/ Is dropping to the bottom of the page. Could you please advise on how to fix it? Thanks. | Your <code> #leftcontent </code> div is not closed out with a closing <code> </div> </code> tag after your loop. Edit your index.php, find the Loop , and look for the end of the loop (usually it looks like <code> endwhile; endif; </code> . Add a closing <code> </div> </code> tag immediately after that (but ... | CSS - why does my sidebar drops to the bottom of the page? | wordpress |
I know the ultimate seo plugin for seo optimizing seo. But with more that 250 post, and no seo plugin installed, i like to know if there is a plugin that will 1) make the title of the page, the title of the post 2) make the description based on the first paragraph 3) make the keyword meta by parsing the whole post, ret... | take a look at WordPress SEO by Yoast it will cover : 1) make the title of the page, the title of the post 2) make the description based on the first paragraph as for your #3 make the keyword meta by parsing the whole post, retrieve all the relevant word that are more that 3% occurrence, and fill the meta with them I h... | Automatic SEO for wordpress | wordpress |
I'm using the following to let the user login: <code> <form name='loginform' id='loginform' action='<?php echo get_settings('siteurl')?>/wp-login.php' method='post'> <label>User:</label><br /> <input type='text' name='log' id='user_login' class='input' tabindex='20' /><input type=... | I'm going to venture a guess here, and maybe someone more versed can back me up or set me straight But here: <code> <?php echo htmlspecialchars($_SERVER['REQUEST_URI'])?>' </code> Is the redirect value.... It is redirecting to the original url, wherever the user came from If you swap that out for your home url wi... | Redirecting after login? | wordpress |
I'm a relatively new Wordpress user, usually I just code my sites by hand though I'm trying to move to a CMS. I installed Wordpress onto a subforlder (http://www.iss.guild.uwa.edu.au/wordpress/) to test. Every now and again I would get warning messages like below, though starting today I started getting fatal errors. A... | The Health Check plugin is triggering the first error. Is this when you're running 2.7? <code> get_transient() </code> was only introduced in 2.8, which would explain it's absence. The second failure is merely a failed HTTP request. This can happen every now and then (mainly due to timeouts). It shouldn't interrupt the... | Need help decrypting error and warning messages | wordpress |
I am using the publish_post action to run some checks on a user after their post is published: <code> $author_ID = ???? add_action('publish_post', 'rhb_check_current_user', 10, $author_ID); </code> How can I get the original author's ID? | use <code> add_action('publish_post', 'rhb_check_current_user'); </code> and in your rhb_check_current_user function check using the global $post: <code> function rhb_check_current_user(){ global $post; $author_id = $post->post_author; ... ... } </code> | get author of published post | wordpress |
I have a custom theme. There is no comments.php file, Wordpress is using whatever the default is. I need to modify the comments area, but I want to base my changes off of the default template. Where is the default template and how can I copy it into my own theme's comments.php? UPDATE Sorted it out for myself. The foll... | I got some help from Wordpress forum. As of Wordpress 3.1 a function called <code> comment_form() </code> creates the submit comment area. You can override default settings by creating an argument list and passing it in as a parameter. Here is a quick example where I change the default header Reply to Comment and then ... | Default comments file and how to copy it | wordpress |
I've read about the WP enqueue_script() function, but if I wanted to use a newer version of jQuery than what my WP installation is using, can I load it through this & WP will use the latest version? or will it load both? or what will happen? Thanks! | To replace the default jQuery url, do: <code> wp_deregister_script( 'jquery' ); wp_register_script( 'jquery', 'your custom url', ... ); </code> Then call <code> wp_enqueue_script( 'jquery' ); </code> as usual. Note that various pages in the WP admin might not be compatible with never versions of jQuery, not to mention ... | Loading a newer version of jQuery within WordPress | wordpress |
I'm tired of editing functions.php every time I want to add/remove a sidebar. I know there is Sidebar Generator plugin , but I wanted to develop something on my own that will work out of the box without plugins. Anyways, I already know how to list all sidebars, how to register them and remove, but I'm not sure how to d... | The code for this plugin is actually pretty simple. The init function loops through all the sidebars (stored in the wp_options table) and registers them in wordpress: <code> <?php function init(){ //go through each sidebar and register it $sidebars = sidebar_generator::get_sidebars(); if(is_array($sidebars)){ foreac... | Sidebar Generator? :) | wordpress |
I know, wp_head() is important, but it inject so much crap into the header, i like to get it out... and just add manually the 2-3 line of code i need.. BUT, and there is always a but, i need the wordpress auto-generated code for : <code> <meta name="description" content="" /> <meta name="keywords" content="" /... | You can remove some of the header stuff with the following. <code> // remove unncessary header info function remove_header_info() { remove_action('wp_head', 'rsd_link'); remove_action('wp_head', 'wlwmanifest_link'); remove_action('wp_head', 'wp_generator'); remove_action('wp_head', 'start_post_rel_link'); remove_action... | Wordpress wp_head() crap | wordpress |
I'm in the midst of building a Wordpress Plugin that adds a custom post type, for which I'd like to include a default template to display. Essentially, this is an event management plugin, and the custom post type is for the Events. There's a handful of custom meta fields, as well as a child post type (Performances), so... | You might want to look at the routine that WP uses for this: <code> locate_template() </code> . It is in <code> wp-includes/theme.php </code> and is called from a number of functions in that file. Those functions are used by <code> wp-includes/template-loader.php </code> to select the correct type of template based on ... | Creating a default Custom Post Template that a Theme can override | wordpress |
suppose you are viewing a single image from the gallery. You have both previous and next links there (for navigation). but is there a way to also show all the other images from the same gallery in the same page (for example i want to show other images from same gallery) if there is a way then can anyone please provide ... | At it's very simplest, add this to your theme's <code> attachment.php </code> <code> <?php do_shortcode('[gallery id="' . $post->post_parent . '"]'); ?> </code> | show other images from same gallery | wordpress |
EDIT: I want to update one field (post_content) within a known record (id of 4) of a known table (wp_posts) in a new database (new_db). The update has to come from one field (post_content) within a known record (id of 5) of a known table (wp_posts) in the old database (old_db). Is this possible, or is something like th... | Seems like trying to put "field X" into db.table.record.fieldY is too atomic, or requires a better magic wand than google can find. I've gone a head and just ripped the posts out wholesale and injected them into the new DB. Here's how I did it. I hope it helps the next poor sod who finds himself in the same place I was... | MySQL: Possible to replace all of wp_posts.post_content(id#) via UPDATE + REPLACE + SELECT? | wordpress |
I have installed the more fields plugin which gives me access to a custom field checkbox. When setting the field up through the plugin the caption says: Creates single checkbox, which key is either on/off. As you can see by the query I am looking for all the events whose event-archive = on. Is there a better way to do ... | Have you already looked at the output of WP_Query, if you don't submit the "meta_query" key? Do you get the posts for the event-posttype? If yes, then you could check what the "more fileds"-plugin puts in the "event-archive" custom field. Maybe you have to set the value to integer 1 or just submit a boolean true. e.g. ... | custom field as a boolean with a checkbox? | wordpress |
I'm returning a custom hierarchal taxonomy via wp_get_object_terms. The trouble is that the results are being ordered by name or count, neither of which are proving reliable. (I'm using a custom taxonomy for "Location" - City, State, Country - sometimes the State appears before the City) Is there a way I can order the ... | Just a rough sketch to get your idea: countries (hierarchical taxonomy) France (country - sub taxonomy) Champagne (state - sub sub taxonomy) Le Mans (city - term) Angers (city - term) Nantes (city - term) And you want to order: <code> $query_results = query( 'country' => 'france', 'orderby' => 'state city', 'orde... | wp_get_object_terms - How can I order the resulting array by hierarchy? | wordpress |
Is it possible to filter the posts or categories that XML-RPC users see in their mobile application? I have a plugin that hooks into <code> pre_get_posts </code> and <code> list_terms_exclusions </code> to do what I need it to do. I've had requests to allow the same functionality on their mobile devices. | Okay, so I discovered the answer to my question. It is possible to filter the posts and categories that users see in their XML-RPC application. The <code> pre_get_posts </code> and <code> list_terms_exclusions </code> filters are called via the blogger.getRecentPosts XML-RPC method. Inside this function, it calls <code... | Possible to filter the posts or categories that XML-RPC users see in their mobile application? | wordpress |
I want to convert a HTML/CSS layout i made into a WordPress Theme, But i don't know any PHP, I have a basic idea of the structure of a WordPress Theme, So i was wondering if i could just slice my HTML template into a header.php, footer.php, sidebar.php and index.php and just copy paste all the php code bits from the de... | You have the basic idea. You can build up a theme using html and css as you see fit. That controls the look and feel basically. The php brings the content and function. I learned to make themes by picking at other themes until I figured out what the php did. You can look up each template tag in the codex to get an idea... | Making a Wordpress theme based on twentyten | wordpress |
When a new blog is created in a WP Multisite instance I want to be able to set the default theme and configuration options create 2 menus (main and secondary) and associate them with the 2 slots provided by the theme set various theme options as defined on the theme option page What's the best way to go about achieving... | The best hook I can find is <code> wpmu_new_blog </code> (line 1086, <code> wp-includes/ms-functions.php </code> , <code> wpmu_create_blog() </code> ) - it passes 6 arguments like so; <code> do_action( 'wpmu_new_blog', $blog_id, $user_id, $domain, $path, $site_id, $meta ); </code> <code> $meta </code> is an array of in... | Multisite: setting theme and options when a new blog is created | wordpress |
After using this code: <code> //Set custom featured image metabox function customposttype_image_box() { remove_meta_box('postimagediv', 'eezzyweb-webfolio', 'side'); add_meta_box('website_grid_view', __('Featured Image for grid view'), 'post_thumbnail_meta_box', 'eezzyweb-webfolio', 'side', 'low'); } add_action('do_met... | The <code> add_meta_box </code> code you've posted does certainly register the metabox to the bottom of the side area. If the box is shown in the center then i imagine it's because you've(at some point) moved the metabox, as can be done with any of the metaboxes(all drag and drop). WordPress remembers where you move bo... | Featured Image meta box shows at the bottom? | wordpress |
Setting up a WP multisite instance - the client has an existing ontology / set of categories that they want to classify all content across the set of blogs. Also the desire is that any new categories would be added at the 'network blog' level and synced to the other blogs. What's the best way of doing this? | <code> function __add_global_categories( $term_id ) { if ( get_current_blog_id() !== BLOG_ID_CURRENT_SITE || ( !$term = get_term( $term_id, 'category' ) ) ) return $term_id; // bail if ( !$term->parent || ( !$parent = get_term( $term->parent, 'category' ) ) ) $parent = null; global $wpdb; $blogs = $wpdb->get_c... | WordPress Multisite - global categories | wordpress |
I'm writing a plugin and want to have a feature where, in the Admin area, the user will click on a link and it will download a theme to the /themes directory on their server. How would I do this? Thanks. | Ehm... You are writing the plugin or thinking about it? Could you show us some stuff that you already did? You should check the permissions on the server where you want to upload the files. Then - in case - change chmod, upload and then change chmod back for sec. reasons. Maybe the update class will help you a little f... | Create a Plugin to Download Files from Web to Server | wordpress |
[box id='1' text="some texte"] the shortcode, at one point is outputting text the html result is : <code> </p> some text </p> </code> There is an extra closing paragraph in the start and and opening at the end... WHY ? where those come from ?.... any idea ?.. it screw my w3 validation ! ** note i have found... | I discover that it's a know bug, and will be fix in future release Reference here So then, i used this code... not pretty, but do the magic !, thanks <code> $content = do_shortcode( shortcode_unautop( $content ) ); if ( '</p>' == substr( $content, 0, 4 ) and '<p>' == substr( $content, strlen( $content ) - 3... | ShortCode and extra | wordpress |
I tried asking the plugin author and while waiting for a response I figured I'd give this place a try too. This is what wordpress-popular-posts.php looks like: pastebin Is there something I can change in there to include custom post types? Maybe somewhere around line 132 since I'm calling the <code> wpp_get_mostpopular... | Not sure if this is the right place... but line 496 <code> $nopages = "AND $wpdb->posts.post_type = 'post'"; </code> seems to be the only place I see any post selection limited to just post When I've messed around with other plugins, to add in CPTs, I'v elooked for similar selection criteria. And added in my own CPT... | Plugin: Wordpress Popular Posts > Possible to include custom post types? | wordpress |
is there a built-in wordpress function to make the HTML or should I use plain-old PHP? | Since 3.1 there's a class <code> WP_List_Table </code> which makes it a hella lot easier to render tables for an array of data objects. There's very little documentation (read: none) on it yet, but you can check out the source if you're familiar with PHP. | How do I make an HTML table from a database table? | wordpress |
I am developing a Wordpress site that will have a database of car modifications and an embedded youtube video with the results. For example: search for Honda Civic with a spoiler and exhaust. This would generate several posts. Each post has there own video, attributes, and an adsense ad. I am using the term posts loose... | Register a 'car' post type . Register 'spoiler' and 'exhaust' taxonomies to the 'car' post type. Use the Taxonomy Drill-Down plugin to create the "search" you need. The YouTube video URL could be stored as a custom field . | Having trouble understanding custom post type and taxonomy :/ | wordpress |
How would we query posts as long as the post does not equal the ID 2047? Here is the current query. <code> <?php $args1 = array( 'post_type' => 'options', 'tag_slug__and' => array( $triplevel, $divingtrip, 'accommodation' ), 'posts_per_page' => -1, 'offset' => 1, ); query_posts( $args1 ); while (have_pos... | Most of the things you can do with a query are described in the Codex page for WP_Query You need to use the 'post__not_in' parameter eg: <code> $args = array( 'post__not_in' => array('34','54'), // post ids 'post_type' => 'page' );` </code> | Query posts without a specific ID | wordpress |
Is there a simple or easy way to exclude all posts from a custom taxonomy in the loop? I've been looking high and low, and neither SE, SO or Google seem to have a straight answer. I know it can be done via a WPDB query, but that just seems like massive rope to jump for something that should be fairly simple. | The solution to this isn't really that publicised, but it should be. You can do the following: <code> $args['tax_query'] = array( array( 'taxonomy' => 'category', 'terms' => array('cat', 'dog'), 'field' => 'slug', 'operator' => 'NOT IN', ), ); query_posts($args); </code> The operator argument can take other... | How do I exclude a custom taxonomy from the post loop | wordpress |
I've just installed XAMPP on Mac OSX and when trying to install a theme or plugin in WP admin, I'm getting this screen. I've never gotten this on my shared hosting account. how to get rid of it on localhost? | Hi @Scott B: Have you tried updating the permissions for your WordPress files to 755 or 777? UPDATE 1 Thanks to @anu in the comments ( <code> ~/Sites </code> assumes you put websites are in the Mac's default website directory): <code> cd ~/Sites sudo chmod -R 777 * </code> I just checked my <code> httpd.conf </code> fi... | How to remove "Connection Information" requirement on localhost install of WP on MACOSX | wordpress |
I'm using the FLIR for Wordpress plugin (v0.8.9.2) with FancyFonts enabled. I'm running Wordpress 3.1. The problem I'm having is that it appears the plugin is cutting off a couple pixels off of the end of some of the text that it generates. It doesn't do it for all text, but where it happens, it happens consistently. H... | Copy & Paste from comment. Seems like the plugin has a bug. The plugin doesn't seem to be actively maintained anyway, but your best bet is to contact the plugin author. The cufon project is pretty similar and production proven. Just google for it. But in times of CSS3 and HTML5 you could simply insert the font via ... | Wordpress FLIR (Facelift Image Replacement) plugin clipping off end of text | wordpress |
<code> <?php $rp = new WP_Query(array( 'post_type' => array( 'post','videos','projects' ), 'orderby' => 'date&order=DESC', 'posts_per_page' => 4 )); while ($rp->have_posts()) : $rp->the_post(); ?> </code> I noticed that if I change <code> date&order=DESC </code> to <code> rand </code> , it ... | It should be this: WP_Query Order By Parameters <code> <?php $rp = new WP_Query(array( 'post_type' => array( 'post','videos','projects' ), 'orderby' => 'date', 'order' => 'DESC', 'posts_per_page' => 4 )); while ($rp->have_posts()) : $rp->the_post(); ?> </code> | Is there something wrong w/ this code? | wordpress |
i have category-events.php to list my posts tagged 'events' but it wont work for 'events' child categories. ie i have some posts tagged 'events' and one of events' children 'exhibition'. I thought it would use category-events.php automatically but it doesn't. Is this possible as i want to user category-events.php for s... | ah - found it here! stackexchange-url ("How can I make all subcategories use the template of its category parent?") thanks... | one category template for multiple categories | wordpress |
I've been working away at a medium-size WordPress site. So far I've just been hosting the site on my local machine and showing it to internal consultants over our local network. Things are working well, and now it's time to show it off to the client. I've been using git all along, so pushing it to the dev server was a ... | Assuming your wp-config.php is already in place and in order: Step 1. Mysqldump your development database Step 2. Replace all instances of development.domain.com to production.domain.com^^ Step 3. Login to MySQL, run a SOURCE command to import data e.g. <code> source /path/to/file </code> ^^ How to replace all instance... | Migrating data between local and development server | wordpress |
I'd like to employ a sort order option in my theme to allow categories to be sorted similar to pages. Can anyone recommend a plugin that does this? | I needed this requirement a while back. There's a selection of plugins available , but nothing took my fancy. They were (in my opinion) either too bloated, poorly written, or the UI was either lacking or overly complex. Then I stumbled upon Term Menu Order . Essentially it adds a <code> menu_order </code> field to the ... | Plugin for custom sort order for categories? | wordpress |
I'm having a lot of trouble using php query_posts(array('category__and'=> array(1,3))) - it seems to be pulling anything that's in category 1 regardless of whether it's also in category 3 and I only want the posts if they exist in both categories. And ultimately, I need a bunch of OR statements anyway, so is there a be... | Strange, that usage of <code> category__and </code> should be working. As for following logic I don't think you can accomplish anything that complex with query parameters. There are several possible ways to deal with it that I can think of: simplify category structure and/or selection logic; modify raw SQL with <code> ... | And/Or Category Query | wordpress |
Is there a way to send the updated/added values from profile, when a member/user updates his/hers data, to the admin of the site or another emailadress? Can this be the first step? <code> /* do something when user edits profile */ add_action('personal_options_update', 'notify_admin_on_update'); function notify_admin_on... | you got the first part right about using <code> personal_options_update </code> but to be on the safe side add <code> edit_user_profile_update </code> also. and as for sending emails within WordPress the best way would be to use wp_mail , So something like this: <code> add_action( 'personal_options_update', 'notify_adm... | Send automatic mail to Admin when user/member changes/adds profile | wordpress |
Whereabouts can I edit which characters in permalinks are replaced? For example apostrophe's are replaced with nothing, and I would like to have them replaced with hyphens instead. Thanks. | You need to filter <code> 'sanitize_title' </code> and use the second argument, the raw title. See my plugin Germanix for an example. | Editing URL character replacement | wordpress |
I have no use in categorizing/tagging my posts with anything, at all, and it doesn't look very good to have every post say "filed under: uncategorized." Is there any plugin to do this, or do I need to do some manual editing? | Why hack apart what's already there? If you remove the built in taxonomies, you'll end up creating hiccups in core code that expect them to be there! You're much better off just editing your theme file(s), or filtering out categories on the front-end (ask if you need help on that). For example, in your theme's <code> i... | Is there a plugin that will completely remove the category system? | wordpress |
I'm currently implementing wp_nav_menu - all has gone well save for dynamic highlighting. The menu code looks like this (when home, which is a custom link, is selected): <code> <div class="menu-header"> <ul class="menu" id="menu-main-nav"> <li class="menu-item menu-item-type-custom menu-item-object-custo... | I achieved this with some jQuery: <code> $("#sidebar ul li").each(function () { if ($(this).find("a").attr("href") == window.location.href) { $(this).addClass("current-menu-item"); } }); </code> (My nav is in a div with the id 'sidebar', you will need to change the first selector). It checks if the href of the links is... | Custom Menus: dynamic highlighting problem with custom home link | wordpress |
I use this code to pull in an image based on a post's category. Images are named after the category they represent, so a post in category 50 pulls in 50.jpg. <code> <?php foreach((get_the_category()) as $category) { echo '<img src="/path/to/file/' . $category->cat_ID . '.jpg" alt="' . $category->cat_name . ... | <code> <?php foreach((get_the_category()) as $category) { if( file_exists( '/path/to/file/to/include/' . $category->cat_ID . '.php' ) ) include( '/path/to/file/to/include/' . $category->cat_ID . '.php' ); } ?> </code> That should do the trick. If the file doesn't exist, it just skips it. This can be expensi... | Code to pull in a PHP file named after the category ID | wordpress |
I am making <code> readme.html </code> file for a plugin with some detailed setup instruction that need to include screenshots. As rest of UI I want it be consistent with WordPress style and so I looked at its own <code> readme.html </code> . It includes stylesheet with relative path: <code> <link rel="stylesheet" h... | It would be better to include your own CSS file that way you can: Use a relative path to your CSS. Avoid problems getting the path right to the <code> wp-admin </code> directory. Not all people put WordPress in the root directory, so your example above would break for them. Possibly redundancy by reusing the CSS in you... | Styling readme.html in plugin? | wordpress |
I'm writing a theme and adding a menu with several submenu pages. It works fine, except that I'm trying to use only one array to save all the settings into the database and this is causing some issues. The problem is that when each submenu pages is saved, it only saves the values from that page to the array and removes... | Yep you are missing something, On your validate_options function you need to: get an array of all existing options. update only the options your Submenu page handles. return that array. So something like: <code> function validate_options($input){ //do regular validation stuff //... //... //get all options $options = ge... | Submenu pages delete settings from options array when saved | wordpress |
I found the code on the WP Recipies page to force excerpts on the home page: <code> function my_excerpts($content = false) { // If is the home page, an archive, or search results if(is_front_page() || is_archive() || is_search()) : global $post; $content = $post->post_excerpt; // If an excerpt is set in the Optional... | Replace the last row of code from: <code> return $content; </code> To: <code> return $content.'<a href="'.get_permalink($post->ID).'">Read More...</a>'; </code> | How to link up "read more" on excerpts hack from WP Recipies | wordpress |
Currently I am running a Wordpress MU blog using the Unfiltered MU plugin. However, when I try to insert an HTML5 tag, it gets stripped away. I believe it may be the WYSIWYG editor cleaning the code. Where can I change settings to allow ? Thanks | Just FYI... WordPress 3.2 includes an updated TinyMCE which allows HTML5 tags. It's still under development but is fairly stable if you want to take the risk of running it now. The alternative is to write any posts requiring the tag with the visual editor turned off. As long as you don't turn the editor on again on tha... | How to allow html5 tag in Wordpress | wordpress |
I have to get specific page content (like page(12)) I used that : <code> <?php $id=47; $post = get_page($id); echo $post->post_content; ?> </code> Work nice execpt for compatibility with qtranslate it return french and english text But the loop is fine, return only the good language version <code> <?php if(... | Here is the solution i have founs that work fine...the codex should be more specific about the apply_filter ... used it all everytime <code> <?php $id=47; $post = get_page($id); $content = apply_filters('the_content', $post->post_content); echo $content; ?> </code> But i have found a great place to ask questio... | Proper way to get page content | wordpress |
I have installed the Google Analyticator plugin on my site. I am also using the MobilePress plugin to serve up a theme designed for non-smart-phone mobile browsers. I have set up Google Analytics for Mobile for use in this theme and would like to disable the Analyticator plugin since it includes a call to a larger js f... | When WordPress activates a plugin, it calls the <code> activate_plugin() </code> function. This function activates the plugin in a sandbox and redirects somewhere else on success. It's been used by a few authors to programmatically activate plugin dependencies. There's another function, <code> deactivate_plugin() </cod... | Disable plugin / plugin action via theme | wordpress |
Hey guys..... I have a page template I have made up & I also was POST'ing to it to process the form.... originally it was working fine, but I moved around some code & now it's not working for some reason. It just redirects to a 404 page for some reason?? Not sure if it matters but here is the code from the temp... | WordPress listens to both <code> $_GET </code> and <code> $_POST </code> when parsing a request. If your form input names are conflicting with native query parameters, you'll send WordPress on a wild goose chase (and most likely end up with a 404). For your leisure, I've kindly listed them here - if any one of your for... | Why is POST'ing to my WP page template producing a 404? | wordpress |
Is it possible to export the posts of a blog as a PDF? There is a blog with a couple of hundred posts that I'd like to read on my ereader, so I was wondering whether I could extract those posts into a PDF? Thanks for the help! | This kind of content scraping is frowned on. You're trying to grab someone else's content and put it into a transferable format over which they have no control. Yes, your intentions are sincere, but don't be surprised if several people are hesitant to help. You do have some options, though. Contact the blog author This... | Export a blog(not mine) as a PDF document | wordpress |
Fiddling around with a custom post type which is quite heavy modified. Started doing some testing to see if I had broken some function, and realized that wordpress doesn't have a function that checks if a post has any content at all. Meaning, if I press "Add new" and just press publish, it won't say a word just save th... | When i needed a solution to the save "problem" i create an Ajax function to validate the fields and did some minor JQuery hacks: first we add our JavaScript to capture the submit/publish event and use it to submit our own ajax function before the actual submit <code> add_action('wp_print_scripts','my_publish_admin_hook... | Stop wordpress from creating empty/null entries | wordpress |
I have a Wordpress site that I just updated to 3.1. I want to make use of custom post types now, my question is how can I assign (transfer?) a post to a newly created custom post type ? For example, all my articles (news, poems, ideas to change the world) are in Posts. Now I have created the custom post types News, Poe... | It seems that the easiest way is to do it manually in the DB. If you don't have access to the DB, or if you don't want to do it manually, you can install a plugin that will do it one post at a time, or a plugin that will bulk convert a lot of posts at once | How can I convert Posts into Custom type posts? | wordpress |
I have NoSpamMX plugin installed. I was not getting spam comments for a long time. But now I am getting a lot of spam comments especially in one post. What is the reason that there is such a lot of spams only to that post? | +1 for akismet http://wordpress.org/extend/plugins/cookies-for-comments/ Is also amazing. Akismet is great at catching spam, but adding cookies for comments is awesome. It stops a lot of the auto-posted spam. (Which most of it is) Cookies for comments will stop the comment before it even gets to you. Akismet was catchi... | How to prevent spam comments? | wordpress |
This is a bit of a specific question--I have found bits and pieces of information on the net, but nothing that puts the whole picture together for me. Hopefully I can get some help here. Background: I am a newbie to Wordpress. I'm using it as the CMS for a t-shirt shop I'm working on. My 't-shirts' custom post type is ... | http://www.rvoodoo.com/who-are-the-voodoo-empire/ Something like that I assume? That's a CPT displayed as sort of a grid. Basically, you wrap the loop in a div. Set the width of that div. Say your overall width is 900px for your page. You could set the post width as 250. so 3 of them will be 750 wide, that gives you 15... | Displaying custom post types as a gallery | wordpress |
I'm using this library to auto-update my plugin, but it's only extracting the new plugin files into a .tmp directory, while the old plugin files stay where they are. Can anybody help me fix this to overwrite the old files or any ideas as to why it would be doing that? Edit: I know that the library above does not actual... | Are you able to update standard WP repo plugins? I am using that library and it seems to work well. What's the exact error that WordPress gives on the admin screen when it tries to run the update? I would take a look at permissions first. What are the permissions on the old plugin directory? Any different than any of y... | Auto-Update Plugin Creating .tmp directory, not overwriting old version | wordpress |
i've found out that there are custom fields but i'm not able to activate them in the admin panel .. :( i've checked the screen options but there's no custom fields - looks like it depends on the template i'm using. any ideas how to modify it in order to enable custom fields for posts? thx | The visibility of custom fields on the post edit screen is controlled on the post edit page. There's a button called "Screen Options" towards the top of the screen. Clicking that button will display all of the available boxes and panels for the edit page. If custom fields is not visible here, then either your theme or ... | enabling custom fields in admin? | wordpress |
hey guys, is it somehow possible to do the following: <code> wp_list_pages() </code> lists each link inside a <code> <li> <a href="link"... </code> <code> <?php wp_list_pages('title_li=&depth=0&exclude='); ?> </code> Is it possible to add a #hash to those links? Like <code> <a href="link#somet... | I'd wrap it in a function (save it in <code> functions.php </code> ); <code> function wp_list_pages_with_hash( $hash, $args = '' ) { $add_hash = create_function( '$link', 'return $link . "#' . $hash . '";' ); add_filter( 'page_link', $add_hash ); $result = wp_list_pages( $args ); remove_filter( 'page_link', $add_hash )... | adding a #hash to each link in list_pages()? | wordpress |
How to list all existing sidebars? I want to show them all in the drop down list (so each item should have also the right value). | You can only gel list of registered sidebars, from variable $wp_registered_sidebars . <code> <?php global $wp_registered_sidebars; echo '<pre>'; print_r($wp_registered_sidebars); echo '</pre>'; </code> | Listing all sidebars | wordpress |
I created a custom post type with a couple of fields where the user can enter the start date and the end date for a project. I am trying to implement the jQuery datepicker but nothing happens when I click on the input fields using 1.7.3; if I use 1.8 it throws an error <code> $(input).zIndex is not a function </code> U... | maybe you include your scripts ui-core and picker too early. Use <code> wp_enqueue script() </code> to include on the right hook. You must not include ui-core, only datepicker! example: <code> wp_enqueue_script( 'jquery-ui-datetimepicker', \ $this->get_plugins_url( 'js/ui.datetimepicker.js', __FILE__ ), \ array('jqu... | Add jQuery UI datepicker to admin panel | wordpress |
when attaching videos (eg. .flv) to a post - is it possible to query its dimensions? the problem is - i've got videos in 4:3 and 16:9 format and i need to get this information. any ideas? thanks | php-flvinfo and php-mp4info are php classes for reading flv and mp4 metadata. you could read it on the fly, or it may be possible to hook a save to get this info in the db somewhere. | getting video dimensions | wordpress |
I created theme options page using Settings API, everything works fine but I can't save options. I tried to figure it out where I missed something but I failed. Any idea what can cause this problem? Here's code of my options page <code> <?php /** * This functions registers default options values for Evolutionary the... | @Mamaduka: Here is why your settings aren't updating. Your validation function is wrong. To wit: <code> function ev_options_validate( $input ) { $ev_options = get_option( 'theme_evolutionary_options' ); $valid_input = $ev_options; $ev_options['color_scheme'] = array_key_exists( $ev_options['color_scheme'], ev_get_valid... | Can't save options | wordpress |
Im creating a simple login/registration page incorporating user moderation and bootstrapping wp for the heavy lifting. I can get the new user added to the db and a password gets created and hashed and all, but when i go to login w/ that account the password won't work. i'm stumped... Anyone see anything i'm missing? <c... | Got it. Cant use wp_update_user for new addition i guess. need to use: <code> wp_create_user( $userdata['user_login'], $userdata['user_pass'], $userdata['user_email'] ); </code> | wp_generate_password sets password but can't login using created password | wordpress |
I am thinking, how might I setup a development server locally then when done, upload and sync files + data to test/production server? I think options like <code> siteurl </code> and <code> home </code> in <code> wp_options </code> database table will need to be changed, also, in <code> wp-config.php </code> some settin... | It's quite difficult to keep data from a dev version in sync with data on the production site. But for an initial deployment, you are correct that it requires changes to wp-config.php and the database. Install Wordpress on your dev machine, e.g. dev.example.com/blog/ Install Wordpress on your production machine, prefer... | How might I setup a development server (local) and a test/production server (remote) | wordpress |
i've attached a local .flv video to my post (it was uploaded and is inside my mediapool). my question: how can i display it inside my post? (the video player) thanks | The .flv is not a video player in itself, rather just a video file to be played in one. To display it, you'll need to play it from an actual video player. Unlike .wmv and .mp4, .flv files won't play natively in your browser without one. There's a couple great open source options out there. There are also a few plugins ... | displaying flv-video attachment in post | wordpress |
Hi I'm trying to use this plugin: http://wordpress.org/extend/plugins/wordpress-simple-website-screenshot/ I am supposed to use the shortcode: <code> [screenshot url="www.example.com"] </code> Because I am writing the code in the single.php file I am using: <code> <?php echo do_shortcode( '[screenshot url="www.examp... | You're trying to execute PHP inside a string! Instead, concat the string; <code> <?php echo do_shortcode( '[screenshot url="' . get_the_title() . '"]' ); ?> </code> | Using the title of the post in a shortcode | wordpress |
On my last Wordpress 3 projects I successfully used custom post types and taxonomies coding the implementation by myself. As regards to custom write panels, I always used the more fields plugin without any problem. Now I am developing a whole new theme which needs to be totally independent from that plugin therefore I ... | I always loved this article mainly for the reason that its about creating a class to use for your metaboxes. | Good tutorial on how to make custom write panels in Wordpress 3? | wordpress |
I've created a custom post type single template. I noticed that when I turn off comments, I get a notice that says "Comments are closed." Looking at my comments.php, I get this little bit of code: <code> <?php else : // or, if we don't have comments: /* If there are no comments and comments are closed, * let's leave... | Add a post type check to the <code> if </code> clause; <code> if ( ! comments_open() && ! is_page() && 'duka' != get_post_type() ) : </code> | Remove "Comments are closed" Notice from Custom Post Type template | wordpress |
My sidebar loops through all of the child pages based on the parent page. For example, if you're in the "About" section you'll only see "About" child pages in the sidebar. My problem is that I have no way of highlighting the current page. For example, if you're on the child page "Our Team" (under "About") I'd like to g... | I see that you are have a hard time on this so here: <code> <?php global $post; $curent_post = $post; $curent_post_id = $post->ID $parents = array('4','6','8','10'); if (in_array($post->post_parent,$parents)){ query_posts("post_type=page&post_parent=".$post->post_parent."&orderby=menu_order&orde... | Dynamic sidebar nav with current page highlighting | wordpress |
For some reason when I go to one of my clients WordPress installations, and I install a plugin that I made which has custom TinyMCE buttons, when they click on one of the buttons the popup appears but there's no text. In the JavaScript console of Google Chrome before I even click the buttons, there is the following: <c... | If I am not mistaken in PHP <code> Array </code> commonly comes up when array variable is wrongfully used where string is expected. But from this information I have trouble suggesting where exactly that can go wrong. | Getting a 404 in Debugger for example.com/wp-admin/Array? | wordpress |
If I wanted to put the scripts that all my plugins use at the end of the page, where would I do this? Using YSlow/Firebug it recommends this tactic. | The hook for registering the script in the footer is: <code> <?php function my_init_method() { wp_register_script( 'myscript', 'http://www.mydomain.com/js/myscript.js','','','true'); wp_enqueue_script( 'jquery' ); } add_action('init', 'my_init_method'); ?> </code> be sure to look at this and this , both are impor... | Scripts at the end of the page | wordpress |
I had upgraded from 3.0 to 3.1 and oembed worked normally. All of a sudden I've lost embedding when directly pasting video url into the editor. My embed setting is selected under "media". Any ideas what could be going on? I've changed themes, ultimately to the native 2010 and still no function. I've tried turning the e... | It appears I've been hoodwinked by my local setup & accidentally stopping connections to vimeo / youtube. This resulted in the video url appearing as only text. Once my setup was restarted everything appears to be working properly. Sorry for the confabulation. | OEMBED seems to have stopped working | wordpress |
I need to make use of the ABSPATH constant but need to know what WP files I need to include so I can make use of it. Thanks a lot! | It is defined at the very start of <code> wp-load.php </code> . However it's value is very primitive - only a path to where file is located, which you could easily get without bothering with including it. | Using the ABSPATH constant - What files need to be loaded before use? | wordpress |
after updating the permalinks from the default /?p=N to another setting (e.g. /%year%/%monthnum%/%postname%/) all my old links are broken and also the archive, catgories etc. side bars get 404 errors. How can I avoid this (or redirect) without changing the .htaccess (which I can't access using my hosting package)? Any ... | If you can't modify .htaccess then chances are WordPress can't either. Save your permalinks again and check if it tells you it couldn't save your htaccess file. That's your problem if so. Bigger question: why are you using a host that won't let you modify .htaccess? That's like renting an apartment from a landlord that... | How do I change the permalink structure without getting 404s? | wordpress |
I'm just wondering what is the correct way to do it? Add it in via the theme header? If so, what is the proper way to do it? I see a lot of the other current stuff in there using the bloginfo() function. Thank You! | You could tack it into header.php as you suggested (although this is not really the proper way to do it, it is best to use WPs enqueue function as described here). When do you need these? All the time? You can enqueue scripts and styles to be used all the time, or on an as-needed/per template basis http://codex.wordpre... | Correct way to include extra styles & script files? | wordpress |
I am using the More Fields plugin which gives me the ability to create a date formatted YYYY/mm/dd and I want to convert that to be shown like: February 11, 2011 Is this possible? | Do you have issue with exactly converting or retrieval? Converting is trivial and is plain PHP: <code> date('F j, Y', strtotime($date)); </code> For more complex and WordPress-specific way with localization support see <code> date_i18n() </code> function. | converting custom field date format | wordpress |
<code> $pp = new WP_Query('orderby=comment_count&posts_per_page=4'); ?> </code> | <code> $pp = new WP_Query(array( 'post_type' => array( 'post', 'custom_type' ), 'orderby' => 'comment_count', 'posts_per_page' => 4 )); </code> | how can i add an array of post types to this query? | wordpress |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.