question
stringlengths
0
34.8k
answer
stringlengths
0
28.3k
title
stringlengths
7
150
forum_tag
stringclasses
12 values
As the title says, if a single dash is used with a space between each side eg. 'Die Hard - Action Film' is written in to a WordPress post, once published it comes out as 'Die Hard -- Action Film'. If no spaces are used around the dash it works, but obviously this isn't desired. I've obviously found out it's not somethi...
It's lines 396 - 398 in the smart youtube plugin's <code> smartyoutube.class.php </code> file: <code> function check($the_content, $side = 0) { if (strpos($the_content, "httpv") !== false ) { $char_codes = array('&amp;#215;', '&amp;#8211;'); // &lt;-- 8211 is an en dash $replacements = array("x", "--"); // &lt;-- here'...
Single dash converted to double dash
wordpress
We are looking into creating a solution that allows user to contribute media files by filling out a form (without access to the admin) and have it ןד created as a custom post type. The files will be either YouTube Movies, PowerPoint Files etc. Is that possible at all? Do you know any example of something similar?
Yes, this is pretty easy using something like Gravity Forms
user contributed content as custom post types
wordpress
I have the following custom function to replace the <code> gallery_shortcode </code> function from core. It hooks in at the beginning and works. The problem is that I can't get my custom key/values from the gallery shortcode in there. I receive them in the core function, but they don't get passed into my custom functio...
<code> &lt;?php function modified_post_gallery( $blank = NULL, $attr ) { echo '&lt;pre&gt;'; print_r( $attr ); echo '&lt;/pre&gt;'; } add_filter( 'post_gallery', 'modified_post_gallery', 10, 2); ?&gt; </code> In media.php it shows the filter like this: <code> // Allow plugins/themes to override the default gallery temp...
Replacement for gallery_shortcode function not taking all attributes
wordpress
Is there a plugin available that does for custom fields what stackexchange-url ("Scribu")'s excellent Taxonomy Drill-Down (formerly called Query Multiple Taxonomies) does for taxonomies?
I used to have a plugin that did exactly this. It was called Custom Field Taxonomies. Then custom taxonomies happened: http://scribu.net/wordpress/custom-field-taxonomies/change-of-direction.html That said: http://wordpress.org/extend/plugins/query-custom-fields/ Let me know if you would like to adopt it.
Plugin similar to Taxonomy Drill-Down for custom fields?
wordpress
Golden Apples Design created (as far as I know) the media upload function that many people on WP.A and elsewhere seem to recommend. But all of the Q&amp;As I can find on StackExchange deal with creating an entirely new post. What is the best way to get this (or another snippet) to upload media from the front-end, attac...
@AboSami actually stackexchange-url ("answered this question") in an older post that was not showing up in my search diligence. While he was actually looking for something else his example code worked great. Here's the script: <code> &lt;?php $post_id = $post-&gt;ID; if ( isset( $_POST['html-upload'] ) &amp;&amp; !empt...
How to add media from front-end to an existing post?
wordpress
I have a custom post type archive template archive-my-posttype.php with pagination. These post types have a custom taxonomy called theme. I am displaying these themes(terms) in the sidebar as a checkbox list. How can I filter the custom post type based on the selected themes/checkboxes? Can this be accomplished by addi...
I believe that what you are describing is how WordPress works out of the box. You will just need to create custom links in your sidebar. Something like <code> example.com/?post_type=your-custom-post-type-slug&amp;theme=taco </code> should query for "all custom posts about the theme named taco".
Custom post type archive with dynamic taxonomy filtering - is it possible
wordpress
I have a lot of custom post types and I have them showing in my "Right Now" Dashboard but it's gotten pretty long so I want to separate them to a custom widget within the dash. See example below: So my question is how do I add the CPTs to a custom dashboard widget? Any help would be awesome. Thanks! EDIT: This is what ...
Lokks like you have a function declared inside another function, your code is wrong, try this: <code> // wp_dashboard_setup is the action hook add_action('wp_dashboard_setup', 'mycustom_moviestats'); // add dashboard widget function mycustom_moviestats() { wp_add_dashboard_widget('custom_movie_widget', 'Movie Stats','c...
Add custom post types stats to a custom dashboard widget
wordpress
I'm trying to use WordPress template tags (through shortcodes) to merge the post title and url into hyperlink html code. Which looks like this: <code> &lt;a href="[Permalink]"&gt;[Post Title]&lt;/a&gt;. </code> Problem is the text output uses curly quotes around the "Permalink" that are not compatible with html code. I...
Just tested this and it worked on my end. The shortcode itself would be [titlelink] <code> function titlelink_ssc($content = null) { ob_start(); echo '&lt;a href="'.get_permalink().'" title="'.get_the_title().'"&gt;'.get_the_title().'&lt;/a&gt;'; $titlelink_ssc = ob_get_clean(); return $titlelink_ssc; } add_shortcode("...
Use template tags in code snippets wordpress
wordpress
The following bit of code results in a duplicate attribute site validation error. This template script: <code> &lt;div class="clearfix" &lt;?php post_class() ?&gt;&gt; </code> produces this source output: <code> &lt;div class="clearfix" class="post-263 post type-post status-publish format-st… </code> WordPress adds its...
Simple fix: <code> &lt;div &lt;?php post_class("clearfix"); ?&gt;&gt; </code> See post_class() for more details
Duplicate attribute class causing site validation error
wordpress
OK so i have <code> custom post types </code> and <code> custom taxonomies </code> . I have a sub-menu that is made of the custom taxonomies. Example: registered taxonomy: Movies and terms: action , adventures , etc . (= menu items) Problem: Now I need to add a highlight -class to the terms when the currently displayed...
Ok. So instead of pasting the code here ill just link to it since i do not feel like adding the code format to each line. This is most likely just temporary but will get what i need done. It is used with some of jquery scripting but should not need it. Feel free to edit as you wish and update this question with your re...
Highlight nav menu terms
wordpress
I hope this makes any type of sense. I want to be able to add clauses to a specific query object without effecting the main loop on a page, for example for content in a side bar or footer. Is it possible?
The most reliable way is to define your own query var and then check it: <code> $my_query = new WP_Query( array( ... 'context' =&gt; 'my_query' ) ); </code> Then, from your callback: <code> function alter_post_clauses( $clauses, $wp_query ) { if ( 'my_query' == $wp_query-&gt;get( 'context' ) ) { // do stuff } return $c...
Limiting posts_join, where, etc to a specific WP_Query object?
wordpress
Is there any way to change the aspect ratio of the WordPress Avatars? Or is this hardcoded? Greetings, .wired
Possible sollutions: Use Css with something like <code> overflow: hidden; </code> and "cut out" what you need. Use the filter <code> apply_filters('get_avatar', $avatar, $id_or_email, $size, $default, $alt); </code> and override the output of <code> $avatar </code> completely. The function <code> get_avatar() </code> i...
Change the avatar ratio?
wordpress
I am using products as a 'custom post type' then I'm displaying a gallery of all products on the home page with a buy button next to each one. When the buy button is clicked, I would like it to redirect to a page with some more info of that product and a checkout form. What do I need to send to the URL using the button...
If you want to reach the "single" page of a custom post type (or even a regular post), you can do this by going to <code> http://example.com?p=[post_id]&amp;post_type=[post_type_name] </code> . If you use Pretty permalinks WordPress will redirect you to the "canonical" link, which may look like <code> http://example.co...
Display one post based on ID from $_GET
wordpress
I'm completely open on how to do this: I have the line: <code> echo implode(', ',get_field('categories')); </code> Which is outputting this: <code> Branding, Web, Print </code> I have 20 or so options it can output depending on what checkboxes were ticked. At the moment, what it's outputting is just plain text. How can...
<code> &lt;?php $categories = get_field('categories'); $elements = array(); foreach($categories as $category) { //do something $elements[] = '&lt;a href="' . $url . '" title="' . $title . '"&gt;' . $name .'&lt;/a&gt;'; } echo implode(',', $elements); ?&gt; </code> at the <code> //do something </code> here you should fi...
Convert imploded plain text into links
wordpress
I want to show the projects that has had it's checkbox ticked as Branding, if it's on the Branding page (i.e the page title is Branding). To explain the code a bit: This line show's all the checkboxes that have been ticked for each project so it will output "Branding", "Web", "Print" if they have been ticked. <code> im...
I managed to figure it out myself reading around, solved it with this: <code> &lt;div id="grid"&gt; &lt;?php $args = array( 'depth' =&gt; 0, 'child_of' =&gt; 411 ); $pages = get_pages(array('child_of')); $grid_title = $post-&gt;post_title; foreach($pages as $post) { setup_postdata($post); $fields = get_fields();?&gt; &...
Match checkbox data with page title to show certain items
wordpress
I have a custom post type whose permalink needs to sit in the same space as pages, like so: <code> /an-example-thing &lt;-- custom post type 'thing' /about-the-things &lt;-- a normal page </code> I'm well aware that this isn't the recommended way to do it , but I don't really have a choice - that's what the client has ...
You start with one bonus point for using my rewrite analyzer :-) Indeed, even if you use verbose page rules, since version 3.1 (or something around that) the taxonomy rewrite rules come even before that. I stackexchange-url ("recently answered another question") with a way to move them really to the top. This should wo...
Using /%postname% for a custom post type
wordpress
Basically I've made a plugin to create a new post type (event). Now I want to create a <code> single-event.php </code> layout file. I don't want to have to stick it in the theme folder, I want to put it into my plugin folder. How do I make wordpress know its there? Thanks
Here is the code that will let you return your single-event.php if the post type is event: <code> function my_event_template($single_template) { global $post; if ($post-&gt;post_type == 'event') { return dirname( __FILE__ ) . '/single-event.php'; return $single_template; } add_filter( "single_template", "my_event_templ...
Create theme files for plugin
wordpress
I'm working on a project where I need display 2 post from one category and also I need to put another loop between this post post to display random list of post from other category. Easiest way to do so is to create 3 queries, but when I created 2 queries for one category, but here I got problem one loop breaks and dis...
I would use <code> get_posts() </code> for your two ad hoc Loops. (Actually, you only need one ad hoc Loop, if you're modifying the main Loop so that only 2 posts are retrieved.) e.g. <code> \\ code modify main Loop to return only 2 posts goes here $firstpost = true; if ( have_posts() ) : while ( have_posts() ) : the_p...
Loop inside the loop
wordpress
Within "install plugins" I'm receiving an error stating "An Unexpected HTTP Error occurred during the API request." When I do a plugin search it throws me back to my site's 404 page. Any idea what would prevent my site from syncing properly with WordPress's servers? I added Hameedullah's code to functions.php and recev...
You can use the following code to dump the HTTP Api response, will help you figure out the cause of error. <code> function dump_http_api_response($response, $type="", $transport=null ) { if ( $type == "response" ) var_dump ( $response ); } add_action('http_api_debug', 'dump_http_api_response', 1, 3); </code> Example Ou...
What causes an Unexpected HTTP Error within install plugins?
wordpress
I'm looking for a way to add body class depending on the User Agent of the client with php. I'm looking to implement it this way: page.php: <code> &lt;body id="front" &lt;?php ( function_exists ( 'body_class' ) : body_class($classes) ? NULL ); ?&gt; &gt; </code> Or by using adding it to the functions.php file FYI: The ...
something like this maybe: <code> function my_class_names($classes) { $useragent = $_SERVER['HTTP_USER_AGENT']; if(strchr($useragent,'Safari')) $classes[] = 'Safari'; // etc.. return $classes; } add_filter('body_class','my_class_names'); </code> Edit - as per Chip's suggestion, here's the function using the WordPress u...
Add Useragent to the body class?
wordpress
I can't use any of the import plugins because of the older version -- so it's kind of a pain, plus the URL permalinks arent very optimal. Any ideas on how to do this? I'm afraid I'd have to do this manually! import plugin I mean. the xml import file format changed so I can use it to upload content =/ –
If you site is live then you shouldn't directly update that, although update in the recent version of wordpress is very easy and seemless but that wasn't the case in 2.1 though. Also here is the list of steps that I will recommend you to take: Make the list of all plugins. Make sure none of the plugin's are responsible...
How can I migrate a super old version (2.0) of my blog to 3.1?
wordpress
Ive got some super old links that have a lot of SEO juice and I dont want to lose that if I change permalink structure. This is partly due to the older version of WP i have (2.1) I want to use post ids in the structure now, and not the slug name or maybe both myblog.com/post/12121/slug-name If i use htaccess for this w...
Yes you need 301 redirection and you will carry on your SEO juice to the new URLs.
If I change permalink structures, can I use htaccess to permanantly redirect links?
wordpress
Is there a plugin that will notify users of comment replies? I don't want a email notification but something on the sidebar where a user can click and see what posts have been replied to. Kind of like a subscription thing?
Recent Comments Widget shows recent comments(including author name and link to the blogpost). You can add it to the sidebar as well.
Looking for plugins that notify users of comment replies
wordpress
I'm trying to do a MySQL-style search with Wordpress' built-in functions for fetching posts. There's likely a simple way to do this and I'm probably just a little bit off from the solution. We have posts with custom fields in them. This is legacy data imported as a custom post type with custom_fields being the extra da...
You can use meta_query in WP_Query <code> $args = array( 'post_type' =&gt; 'post', 'meta_query' =&gt; array( array( 'key' =&gt; 'subject', 'value' =&gt; 'Subject Two', 'compare' =&gt; 'LIKE' ) ) ); $query = new WP_Query( $args ); </code>
Get all posts WHERE custom_field is LIKE value
wordpress
Im searching for some clue about this behavior? I think it is a PHP memory_limit or WP define('WP_MEMORY_LIMIT', 'X') issue? Sometimes images are resized and sometimes not, in other scenarios the browser crash: Im using Dreamhost as shared hosting, and their 7 upload limit. Error printed with an uploaded image of 6.4MB...
I've had the same issue in the past when uploading very large images. When it comes to crunching the image it fails and shows HTTP ERROR in red. However other images continue to load. It wasnt file size where it would fail but rather the pixel width and height of the images. By default PHP settings, the most GD libary ...
Looks like image resize is not working well
wordpress
I want to make one long post, but have it paginate. I read that you could add this: <code> &lt;!--nextpage--&gt; </code> , but all it did was hide the content under the tag. Is there a plugin that helps do this? Is it possible that my theme may not allow this?
Your theme must have support for the <code> &lt;!--nextpage--&gt; </code> tag. You will need to add <code> &lt;?php wp_link_pages(); ?&gt; </code> in your post loop. http://codex.wordpress.org/Function_Reference/wp_link_pages
How can I split long posts into pages?
wordpress
I need to import users via csv file. I see lots of plugins that do mass imports, but they all seem to send out new user emails to the new users. Since this is currently being set up on a dev site, I don't want to send out the new user emails. Are there any plugins that import users without sending out new user notifica...
The CSV User Import looks promising...looking through the plugin file, I don't see anything regarding registration emails.
Mass Import Users without sending new user notification
wordpress
i was making a gallery on my clients site using <code> [gallery] </code> sortcode. The gallery appears but when clicked it goes to clients other website which i have no idea why? here is the link http://www.build12.com/promotions-pictures/pictures/ check the wired link of the pictures. The wordpress version is 3.1.1. P...
look at your javascript in the header for the thumb info: <code> script&gt; var thumbfile = "http://bricksandwindows.build12.com"; </code> also repeated on line 179 when viewing source
Whats wrong with my wp gallery?
wordpress
can anyone help me with this? I need to print the slug of my custom taxonomy, can this be done? The following kind of works but it just shows the name, rather than the slug which i need for a class purpose.. <code> &lt;?php $terms = get_the_terms( $post-&gt;ID , 'area' ); foreach( $terms as $term ) {print $term-&gt;nam...
<code> $term-&gt;slug </code> Here is an example return of $term: <code> stdClass Object ( [term_id] =&gt; 31 [name] =&gt; Architectural Items / Salvage [slug] =&gt; architectural-items-salvage [term_group] =&gt; 0 [term_taxonomy_id] =&gt; 31 [taxonomy] =&gt; dcategory [description] =&gt; [parent] =&gt; 5 [count] =&gt;...
Show Custom Taxonomy Slug(s)?
wordpress
I'm adding a custom profile field to users of a specific role, like this : <code> function add_custom_profile_fields( $fields ) { // get current user ID $user = new WP_User( $_GET['user_id'] ); // get current user role if ( !empty( $user-&gt;roles ) &amp;&amp; is_array( $user-&gt;roles ) ) { foreach ( $user-&gt;roles a...
Ok, I was doing it wrong, here's a working solution, based on Justin Tadlock's tutorial . <code> &lt;?php /* Add custom profile fields (call in theme : echo $curauth-&gt;fieldname;) */ add_action( 'show_user_profile', 'my_show_extra_profile_fields' ); add_action( 'edit_user_profile', 'my_show_extra_profile_fields' ); f...
Saving custom profile fields
wordpress
I've been strugling with the following issue for over a week now so please excuse the long description. I want it to be as accurate and clear as possible: I'm using the "simplr registration form" plugin to register new users. I need to add to the form an "address" field for the users to fill, and when the submit button...
The php function which handles the submitted values in this plugin checks first if the button's value <code> isset </code> . When using the original submit it is. When using <code> preventDefault() </code> and then calling <code> submit() </code> it isn't and therefor the php doesn't handle the submitted form but rebui...
Form doesn't submit on second submit call
wordpress
I'm using the Newsletter plugin (http://wordpress.org/extend/plugins/newsletter/) to compose e-mail newsletters. Using the "auto-compose" feature to pull website data via the theme included with the plugin, which I have begun to customise. It's pulling posts just fine, which is a good start - but I would also like to p...
You may already know this, but you need to specify the widget's class name as the $widget_name variable in the template tag. For example, Depending on the widget, you may also need to add parameters to the_widget() to get it to display properly — see notes on thewidget() $instance and $args in the codex. http://codex.w...
Include widget within newsletter template?
wordpress
For the Stack Exchange Community Blogs, we have a network install that we've set up. I am being told that the site administrator role is not allowing an option for user editing. On the site's users page when hovering over a user, there is only an option for <code> delete </code> , not one for <code> edit </code> . The ...
As explained in the description of the Network Admin Users screen, in a network install (multisite mode) users are added on a global basis to the entire network, then assigned to specific sites Normal administrators are not permitted to modify these global profiles, since their privileges extend only to their given sit...
Site admin in a network install can't edit users?
wordpress
I am working in a new project, and I just realized that in the page/post edit pages, I don´t have the option to set a featured image/ post thumbnail. I have checked and Twenty Ten has thumbnails support by default ( add_theme_support( 'post-thumbnails' is in functions.php). I also tried setting the thumbnails size with...
The featured image meta box is enabled under following conditions: <code> if ( current_theme_supports( 'post-thumbnails', $post_type ) &amp;&amp; post_type_supports( $post_type, 'thumbnail' ) &amp;&amp; ( ! is_multisite() || ( ( $mu_media_buttons = get_site_option( 'mu_media_buttons', array() ) ) &amp;&amp; ! empty( $m...
Post thumbnails not working in my new install of WP 3.1 with Twenty Ten theme
wordpress
trying to stop get_the_excerpt() from defaulting to the_content() if its empty. this kinda works - well it seems to return 'xxx' so i think has_excerpt() isn't working? <code> function get_link_excerpt(){ if(has_excerpt()){ $LinkExcerpt = get_the_excerpt(); return $LinkExcerpt."..."; } return 'no excerpt'; } add_filter...
WordPress sets up a default filter for <code> get_the_excerpt </code> : <code> wp_trim_excerpt() </code> . It is this function that will generate an excerpt from the content "if needed" . If you don't want this behavior, you can just unhook the filter: <code> add_action( 'init', 'wpse17478_init' ); function wpse17478_i...
excerpt - don't use main content if empty
wordpress
i'm using the BAAP Mobile version plugin and the footer link that switches between desktop and mobile version is being displayed outside of the wrapper> footer divs. Is there a hook or a method to have the switcher link display in the footer section? This is the function that creates and displays the links in the wpmp_...
If you look in the plugin's directory <code> plugins/wpmp_switcher/wpmp_switcher.php </code> on line 53 you will see this: <code> add_action('wp_footer', 'wpmp_switcher_wp_footer'); </code> so you can either remove this action and call it in your theme your self with: <code> remove_action('wp_footer', 'wpmp_switcher_wp...
How to display a link in the footer section
wordpress
I'm attempting to set up a wiki within a Wordpress install and love the way codex.wordpress.org is set up. Are they using a specific plugin to accomplish that or just well structured pages? Is there a similar plugin available to users?
Hi in the wordpress.org header is this: <code> &lt;meta name="generator" content="MediaWiki 1.15.5" /&gt; </code> which leads me to think that it is this that is used MediaWiki regards Martin edit: something similar was aked before and it looks like a plugin solution was found <a href="stackexchange-url Plugin Similar ...
Does codex.wordpress.org use a plugin of some sort? If so what plugin?
wordpress
I have several sites with Custom Post Types and Taxonomies registered by different plugins. Is there a way to add or change a parameter like this <code> "'rewrite' =&gt; array( 'hierarchical' =&gt; true )" </code> by adding something to functions.php—without completely re-registering the type/taxonomy? I want to contin...
you could modify the global variable $wp_post_types or in the case of taxonomies, $wp_taxonomies for example, this will change the menu name and all the labels for the default Posts to Bacon: <code> function change_post_menu_label() { global $menu; global $submenu; $menu[5][0] = 'Bacon'; $submenu['edit.php'][5][0] = 'B...
Add/overwrite a parameter on an existing post type/taxonomy
wordpress
When using a modal window such as lightbox or shadowbox to display a post's images, client would like to be able to choose the background color that would be used for the modal window according to the image to be shown: color would be either black, white or grey. I'm thinking such hack should be done via a plugin but i...
You can store the chosen color in a meta field. We have a question about stackexchange-url ("adding a custom field to attachments"), it contains an example. The hooks you need are <code> attachment_fields_to_edit </code> and <code> attachment_fields_to_save </code> .
Set a background color per image added to a post
wordpress
I've used the wordpress plugin - advanced custom field and would like to show an array of a child, here's my code: I'm using this code to show the custom fields data from a specific page ID's children: <code> &lt;?php $args = array( 'depth' =&gt; 0, 'child_of' =&gt; 411 ); $pages = get_pages(array('child_of')); foreach...
This will show the checkboxes that have been ticked (much simpler!!): <code> &lt;?php $categories = get_field('categories'); $elements = array(); foreach($categories as $category) { //do something $elements[] = '&lt;a href="/tags/design/' . strtolower($category) . '" title="' . $category . '"&gt;' . $category .'&lt;/a&...
Wordpress - Display array data of a child
wordpress
I have my own theme that I've created and I need to support 3 languages. I started by adding the gettext functions to my template _e("string","namespace") etc, generated the po file with Poedit, and then created the .mo file for Spanish (es_ES) My current setup which is not working > Update wp-config.php <code> define ...
You need to load_theme_textdomain() in your theme. Place this in theme functions file: <code> function theme_init(){ load_theme_textdomain('theme_name', get_template_directory() . '/languages'); } add_action ('init', 'theme_init'); </code> Then you put you language files in you theme /languages folder you language file...
How do you install a .MO (language file) to use as part of a theme?
wordpress
I would like to modify WordPress default search. I have 2 questions: which template file to modify, and how can I include posts ids that I want to include in search? I need to search from specific post ids, so I want to modify search in this particular way.
The output of search results is controlled by <code> search.php </code> template (or generic <code> index.php </code> if it's not present). And search is technically a usual WordPress loop with <code> s </code> query argument, so any snippets that apply to loops can be used to tweak search.
modify wordpress default search
wordpress
I have 2 sizes thumbs for featured images with the same height: 300 x 200 540 x 200 I've checked the uploads folder and both thumbs with different sizes appear correctly: file_name-300x200.jpg file_name-540x200.jpg I'm trying to get the bigger thumb size (540x200) as following: <code> $width = 540; $height = 200; echo ...
I think you've hit interesting logic issue in <code> image_get_intermediate_size() </code> . This function loops through available images and tries to find best possible match for custom dimensions you provided. First it attempts to find image as per comment in code: <code> // already cropped to width or height; so use...
Featured image with the same height thumbs returns wrong thumb
wordpress
On the single-post page within the loop I need an array of the_tags() which is a string. and get_tags() gives me all of the tags not only this posts. Is there an easy way to get this?
the function <code> get_the_tags() </code> does for a single post, what <code> get_tags() </code> does for the site.
In need of array of post tags
wordpress
So i got the RSS feed which output some custom post types, but the GUID looks bad to me, it's like: <code> ?post_type=mycustompost&amp;p=124 </code> The reason i want to change this is that I don't need people to know it's Wordpress or to see my custom post type name (this is very important in this project) Is there a ...
The feed template files call <code> the_guid() </code> , which calls <code> get_the_guid() </code> , which has a filter named (surprisingly) <code> get_the_guid </code> . You can hook into this filter to change the output. The filter only gets the current GUID, not the post ID, so look this up in the global variable if...
Change custom post type GUID in RSS
wordpress
I have in the following code in the template: <code> &lt;img src="&lt;?php header_image(); ?&gt;" /&gt; </code> However, I want to change this image according to the language selected (through GET parameter lang). The question is, how to change this function to look for different images according to the received GET pa...
Filter the <code> get_theme_mod() </code> function ( <code> wp-includes/theme.php </code> ): <code> add_filter( 'theme_mod_header_image', 'localized_header' ); function localized_header( $img ) { // Do something awesome with the $img path. return $img; } </code>
How to internationalize header image?
wordpress
I am trying to add oEmbed DeviantArt integration to a custom theme. I found that first step is quite easy, I added <code> wp_oembed_add_provider( 'http://*.deviantart.com/#/d*', 'http://backend.deviantart.com/oembed' ); </code> to theme's functions.php . Now, I would like to change the default HTML output to add more i...
<code> WP_oEmbed::data2html() </code> has a filter, <code> oembed_dataparse </code> . You can use this to change the output, based on the extra data which is passed as the second parameter. Something like this for example: <code> add_filter( 'oembed_dataparse', 'wpse17461_oembed_dataparse', 10, 3 ); function wpse17461_...
How to modify the HTML formatting of an oEmbed link?
wordpress
I changed my user profile name with WP-Optimize from 'admin' to 'indie' (not really 'indie', just to show you better) but author page still is available only trough example.com/author/admin - not example.com/author/indie. Is there anything I missed? Greetings, .wired
take a look at Change the Author Slug from Username to Nickname more specifically at Jan's answer.
Author page doesn't change after username change
wordpress
The following code was mentioned from one of the commentors, however it is breaking the pagination. Any corrections please <code> &lt;?php include(TEMPLATEPATH. '/includes/headline.php'); rewind_posts(); if (have_posts()) { echo '&lt;div class="gridrow clear"&gt;'; while (have_posts()) : the_post(); global $post; $quer...
You need to tell Wordpress to get only 5 posts per page. The parameter to do this is posts_per_page. You should use query_posts() function before your have posts as in the following example. <code> &lt;?php // your includes and stuff global $query_string; query_posts( $query_string . '&amp;posts_per_page=5' ); // now y...
Limit number of posts on a custom category template - breaking pagination
wordpress
There is a site at <code> http://theprimarkonlineshop.com </code> that I want to be redirected to <code> http://theprimarkonlineshop.com/category/blog </code> when a user enters the site. I've tried some stuff like <code> RewriteEngine on RewriteCond %{REQUEST_FILENAME} ^/$ [OR] RewriteCond %{REQUEST_FILENAME} ^$ Rewri...
Here is how I'd do it: http://wordpress.org/extend/plugins/redirect/ Install above plugin Create a page Add custom field: redirect of a value of http://theprimarkonlineshop.com/category/blog Set page you have created to the sites homepage.
Redirect from home page to post list page?
wordpress
I've encountered an issue on a site I'm looking after. The 'admin' account no longer has access to the plugins page, if I try and manually type in the URL to the page, I get the following error: "Page disabled by the administrator" Any idea what could be causing that? Thanks!
I've actually just fixed it myself. The problem was as follows: I had changed the username of the admin account to 'new-admin'. What I had missed when making this change was to update the 'wp_sitemeta' table in the database. meta_id 8 (site_admins) still had the old admin name set. Once I updated this, the plugins menu...
Plugins Page - "Page disabled by the administrator"
wordpress
If I use the wp_insert_post in a plugin, will I have to check the content for SQL injection problems and XSS or will the wp_insert_post function do this for me?
The short answer; absolutely . <code> wp_insert_post() </code> will only SQL escape the content. Use the KSES library &amp; wp_kses() to filter out the nasties, or <code> esc_html() </code> to escape all HTML. Most importantly, check out the codex on data validation (read: sanitization). A Note On KSES: Use wp_filter_k...
Does wp_insert_post validate the input?
wordpress
I created a custom post type:products which also has custom fields: price &amp; shipping. Occasionally, if I leave the edit product window open or refresh it, I lose the values inside price and shipping. Can someone please advise on this. <code> add_action('save_post', 'save_details'); function save_details() { global ...
Check your variables before you work with them. Your save function gets a parameter <code> $post_id </code> . Use it. From my meta box class for a check box : <code> /** * Saves the content to the post meta. * * @return void */ public function save( $post_id ) { $this-&gt;is_allowed_save( $post_id ) and update_post_met...
Custom field values get deleted
wordpress
I am trying to use ids to control the structure of the output of my categories. I need to exclude a category that is part of the parent category that is being queried. What I am trying is : <code> &lt;?php $the_query = new WP_Query('cat=14$cat=-45&amp;showposts=20'); $permalink = get_permalink( $post_id ); while ($the_...
First you should move <code> wp_reset_query(); </code> outside of the loop instead of resetting the query every post of the loop. And as for your query you can use <code> category__not_in </code> <code> $args = array( 'cat' =&gt; 14, 'category__not_in' =&gt; array('45'), 'posts_per_page' =&gt; 20 ); $the_query = new WP...
Exclude a category from a query that includes its parent category
wordpress
I'd like to offer my custom post type as a Plugin, so that people can use it without touching their theme folder. But custom post type templates -- such as single-movies.php -- reside in the theme folder. Is there a way to get WP to check for a single-movies.php in the plugin's folder? Hooking a function into the Filer...
you can use <code> single_template </code> filter hook <code> /* Filter the single_template with our custom function*/ add_filter('single_template', 'my_custom_template'); function my_custom_template($single) { global $wp_query, $post; /* Checks for single template by post type */ if ($post-&gt;post_type == "POST TYPE ...
Custom Post Type Templates from Plugin Folder?
wordpress
I'm using a custom post type to let contributors have a personal page on the site. Any time a user registers to my site a script creates a custom type post that has the registering user as author. To moderate users entries this post is pubblished by an editor. I would like users (contributors) to be: - uncapable to add...
Mine didn't work until I added the '99' , 2); to the end of the add_filter. Here is the reference as to why: http://codex.wordpress.org/Plugin_API/Filter_Reference/wp_insert_post_data <code> add_filter('wp_insert_post_data','re_aprove', '99', 2); function re_aprove( $data , $postarr ){ global $current_user; get_current...
How to let contributors to create a new revision(draft) editing their published posts
wordpress
I have a custom pagination function in functions.php. If I'm at the URL: http://mysite.com/tag/dogs , the Next link currently just contains /page/2. How can I make it so it will look like /tag/dogs/page/2? Here is the function I am using: (originally posted here ) <code> function pagination( $query, $baseURL = '' ) { i...
Why can you not use the core functions <code> previous_posts_link() </code> / <code> next_posts_link() </code> or <code> posts_nav_link() </code> , all of which already account for the taxonomy archive context? EDIT: I think I understand your question now. You want pagination links, rather than previous/next page links...
How to get category/tag in URL for Pagination links?
wordpress
I have learned how to create a post from the frontend but how about editing it ? This is the code stackexchange-url ("I am trying to create a simple frontend form for posting.") Thank you
Just like the example you linked, but instead of using <code> wp_insert_post() </code> you use: <code> wp_update_post() </code> so your form becomes: <code> &lt;?php $post_to_edit = get_post($post_id); ?&gt; &lt;!-- edit Post Form --&gt; &lt;div id="postbox"&gt; &lt;form id="new_post" name="new_post" method="post" acti...
How can I edit a post from the frontend?
wordpress
I know there are other, maybe better ways to do what I want to achieve, but I have to use this solution. I have two stylesheets: <code> style.css </code> - normal stylesheet <code> style-dynamic.php </code> - dynamic stylesheet linked to the first one I'm using some PHP code in the second one, like: <code> #body { back...
Christ, once again I was fighting with something for a few days straight and found a solution 20 minutes after asking on StackExchange. WHY? <code> require_once('../../../wp-load.php'); </code>
Call to undefined function issue
wordpress
So here's the problem, I want to have a few different meta boxes on my sites, but I'd like to be able to store each of them in separate files and included them into functions, so I can just copy specific ones to new installs and included them on a case by case basis. From what I can gather though, it seems like I need ...
Save each meta box out to a file with the code as if they were in your functions.php file. Maybe place these in a folder called meta_boxes. Then to include into your theme just <code> include() </code> them into your functions file <code> &lt;?php // all the code that your functions file contains include("meta_boxes/me...
Multiple Meta Boxes in separate files
wordpress
I'm trying to make something more meaningful out of the <code> wp_link_pages() </code> result: <code> $paged_page_nav = wp_link_pages( array( 'echo' =&gt; false ) ); // Now let's wrap the nav inside &lt;li&gt;-elements $paged_page_nav = str_replace( '&lt;a', '&lt;li class="'.$classes.'"&gt;&lt;a', $paged_page_nav ); $p...
I wouldn’t use WordPress’ internal function. We had a very similar question recently: stackexchange-url ("How to style current page number (wp_link_pages)?") I wrote a small but flexible function to replace <code> wp_link_pages() </code> . It is probably easier to extend this than hacking around the return value of the...
wp_link_page - wrap current page element
wordpress
I need to clean up my database and I think that a way to do and keep it that way is by deleting all posts that have 3 days of life. One good thing is that those posts I want to delete are in a specific category. So, how can I clean up my database correctly by deleting or moving thoem and also their posts_meta or terms ...
here is a quick plugin i cooked for you :) <code> &lt;?php /* Plugin Name: Post Auto Removal Plugin URI: http://en.bainternet.info Description: Post Auto Removal lets you schedule when the post / page / custom type will be deleted automatically. Version: 0.1 Author: bainternet Author URI: http://en.bainternet.info */ /...
Your ideas on my though "delete or move all of the posts in a specific category when 3 days are passed"
wordpress
Is there a way to know what functions are hooked to a particular hook? For example if I'd like to know what functions are hooked to the <code> wp_head </code> hook.
I'm pretty sure that this does what you want: @Rarst's Debug WordPress hooks
How to know what functions are hooked to an action/filter?
wordpress
I am in the process of migrating my blog from my wordpress.com address to a self-hosting (wordpress v3.1.2) address . Blog has migrated across nicely. Appears my users have also migrated across, but they cannot login with there old credentials (which are tied to wordpress.com, right)? I have around 30 users, and I woul...
I don't know if you can see the email addresss of your users in wordpress.com blog as i never used it. If you can, as you have not too many users you may try to add them manually from wordpress dashboard and send them an email with the password if you have access to the email address.
Migrating users from .com to .org?
wordpress
I have a problem using the register_post_type and register_taxonomy on my Wordpress. I created the code on my functions.php and it does not update my panel. Why? <code> //Categorias personalizadas register_taxonomy('produtos', 'produto', array('hierarchical' =&gt; true, 'label' =&gt; 'Categorias de Produtos', 'query_va...
I copy pasted your code into my functions.php and it worked for me, make sure you are using a recent version of WordPress that supports Custom Post Types
register_taxonomy and register_post_type does not work
wordpress
I'm working on an internal project/idea (a directory of sorts for a vertical market) where I will have 40 Categories with each Category having (potentially) 30 Sub-Categories. For each Category and Sub-Category page we need to present (unique for each Cat and Sub-Cat) a block of rich text (and possibly an image) in the...
If i understand correctly then this shouldn't be too hard and i would suggest using this Taxonomy Meta Script to simply add a rich editor , an image field and anything else you need for each category , this would make your life easier.
Dynamically Adding Category Specific Content To Specific Category & Subcategory Pages
wordpress
I'm using the advanced custom field plugin for wordpress and wondering if I'm able to do the following: If checkbox ticked = web and it equals the page title echo this. Does anyone know what code to use for this? UPDATE: The closest I've got is this: <code> &lt;?php $fields = get_acf(); print_r ($fields-&gt;categories)...
The way advanced custom field plugin handles checkboxes is in an array so you work with that array, for example if you field name is <code> categories </code> and you want to see if web (on of the checkboxes) was check you can use: <code> &lt;?php if(in_array('web', get_field('categories') )): ?&gt; &lt;h1&gt;Web was t...
Displaying a checkbox array from advanced custom field
wordpress
I've got an issue with using the WP-Navi plugin and posts sorted alphabetically. The first page of posts (5 - set in the plugin settings) appearing properly, but when one navigates to subsequent pages, I lose that sort. In fact, I can't tell how the posts are being sorted - it appears to be random. The plugin's author ...
Switching to a new navigation plugin solved this problem! <code> http://wordpress.org/extend/plugins/wp-paginate/ </code>
WP-navi plugin and post sorted alphabetically
wordpress
Currently I'm using Simple Local Avatars on several of my blogs allowing people to upload their own custom avatar. As far as I know Simple Local Avatars uses <code> get_avatar </code> to check whether a custom avatar is selected, if not defaults to Gravatar.com. Would it be possible to disable the Gravatar.com bit some...
If you want a super-lightweight solution and don't mind dabbling in a little code, drop this in your <code> functions.php </code> ; <code> function __default_local_avatar() { // this assumes default_avatar.png is in wp-content/themes/active-theme/images return get_bloginfo('template_directory') . '/images/default_avata...
Removing Gravatar.com support for WordPress and Simple Local Avatars
wordpress
i'm trying to set up a mobile theme for my wordpress site. My desktop version uses themejunkie's weekly theme and my mobile version uses dotmobi theme. the Dotmobi theme pulls out the first image and displays as a thumbnail where as the weekly theme displays the 'featured image' as a thumbnail or a picture that is defi...
Try this code. Then temporarily set permissions to the cache folder to 774 and the timthumb.php file to 750, you can increase or decrease the permissions as you see fit (or aslong as it stops working, then it'll be time to loosen up the permissions). <code> &lt;?php // If there are images get them if ( $images = get_ch...
Display featured image as post thumbnail
wordpress
1 custom taxonomy registered for 2 different CPT (custom post type). When i entered to edit tag section on edit-tags.php?taxonomy=mytaxonomy&amp;post_type=cpt1 it displays total post count of 2 different CPT. Is there any way to fix that?
This is a known issue see Custom taxonomy count includes draft &amp; trashed posts . It might not be fixed in version 3.2 but most likely in the next version.
post count is wrong when using same taxonomy for 2 different CPT
wordpress
Ok, bit of a weird one... I want to include php code on one of my pages within the content by adding something like: <code> Welcome to the payment page [paymentform] Blash blah vlha... </code> And then [paymentform] resolves to a bit of code either somewhere on the filesystem or within the database and handled by a set...
Have a look at the Shortcodes API http://codex.wordpress.org/Shortcode_API
Looking for a good way to include php code in posts, but using special include markup rather than direct php code
wordpress
As you can guess from the title, Im looking for a solution that allows me to alter the way Wordpress processes/saves its newly created images according to the media settings in the dashboard. This is very important since I primarily use Wordpress as a way to present portfolio images so they need to maintain the same co...
You can try looking at this plugin WordPress ImageMagick Engine Replaces wordpress image resizing from GD to ImageMagick. You need a compatible host to use it though
How to resize images in wordpress without adding any compression or changing the color profile of the images, possible?
wordpress
How do I hide the page editor (WYSIWYG editor) if the current page is set to a certain template. I have the following code already to add in custom meta boxes when certain templates are chosen: <code> add_action('admin_init','my_meta_init'); function my_meta_init() { $post_id = $_GET['post'] ? $_GET['post'] : $_POST['p...
<code> add_action('init', 'remove_editor_init'); function remove_editor_init() { // if post not set, just return // fix when post not set, throws PHP's undefined index warning if (isset($_GET['post'])) { $post_id = $_GET['post']; } else if (isset($_POST['post_ID'])) { $post_id = $_POST['post_ID']; } else { return; } $t...
Hide page visual editor if certain template is selected?
wordpress
I'm trying out the 2 comment reporting plugins that I know about in a multisite installation. AJAX Report Comments Safe Report Comments Both don't work - various javascript errors and (I assume) not taking into account the differences between single and multisite WP. Does anyone know of a working comment reporting plug...
(Copy from comment to make the solution appear in our search results) Use the Report Comments Plugin from Dagon Design.
Comment reporting for Multisite
wordpress
Could you please suggest me good plugins (that you have used) for translating a WordPress website? It should be wonderful if you can add as well a pros and cons list with your suggestion. Thanks in advance!
I'll speak for qTranslate, I've used it a few times and been pretty happy with it. What it sets out to do - letting you offer translations of post content in multiple languages and switch between them - it does pretty well. It gets a bit dicey when you try to extend it beyond alternate language versions of posts, thoug...
Suggestions for i18n plugin
wordpress
Here is what I want to have My category Structure in WP admin <code> Cat Parent -Cat Child 1 -Cat Child 2 -Cat Child 3 -Cat Child 1 </code> This what I want to have in one template: It show the list of post in Cat Parent Children Category <code> Cat Child 1 -Post1 Child 1 -Post2 Child 1 -Post3 Child 1 -So on... . Cat C...
get the child categories, using get_categories() ; then loop through them with a foreach loop, using WP_Query() : <code> &lt;?php $cats = get_categories('child_of='.get_query_var('cat')); foreach ($cats as $cat) : $args = array( 'posts_per_page' =&gt; 3, // max number of post per category 'category__in' =&gt; array($ca...
How to get child category list post in one template?
wordpress
My theme automatically assign before of <code> &lt;!--more--&gt; </code> tags, as excerpt.And showing excerpt on home page. Now i want to add Google Adsense after <code> &lt;!-- more --&gt; </code> code. I'm wrote this function and add it to functions.php <code> function google_adsense($content) { if(is_single()) { glo...
you have forgotten to return the unaltered $content if this is not a single post: <code> function google_adsense($content) { if(is_single()) { global $post; $thePostID = $post-&gt;ID; $more_span = '&lt;span id="more-' .$thePostID.'"&gt;&lt;/span&gt;' ; return str_replace($more_span, $more_span . " " . google_reklam_ekl...
Excerpt Is Disappeared
wordpress
What is the best way to disable feeds per post type but keep has_archive enabled?
I ran into this issue today. I don't know if it's the best way, but here's how I solved it (with <code> has_archive </code> still set to true, of course): <code> // First we remove WP default feed actions // If we stop here, feeds would be disabled altogether remove_action('do_feed_rdf', 'do_feed_rdf', 10, 1); remove_a...
How to use has_archive but disable feed per post type?
wordpress
I'm using this code: <code> $args = array( 'hide_empty' =&gt; FALSE, 'title_li'=&gt; __( '' ), 'show_count'=&gt; 1, ); wp_list_categories($args); </code> How can i wrap the post count in a span for further styling? Thanks
adding a filter to functions.php of your theme is one possibility: <code> add_filter('wp_list_categories', 'cat_count_span'); function cat_count_span($links) { $links = str_replace('&lt;/a&gt; (', '&lt;/a&gt; &lt;span&gt;(', $links); $links = str_replace(')', ')&lt;/span&gt;', $links); return $links; } </code> this wou...
Wrap Post count in a span
wordpress
I need to display comments starting from the second, omitting the first. With posts I did it using "offset" but I can't find anything similar for comments. Since I'm using threaded comments, must start from the second comment that is not a child (only parent comments). I'm using wp_list_comments with a callback. EDIT2:...
<code> &lt;?php global $wp_query, $post; $comments_arr = $wp_query-&gt;comments; $comments_arr = sort( $comments_arr); $comments_arr = array_pop( $comments_arr ); $comments_arr = usort($comment_arr, 'comment_comparator'); $comment_count = get_comment_count($post-&gt;ID); ?&gt; &lt;h3 id="comments-title"&gt;&lt;?php pri...
Comments offset
wordpress
If I create a custom post type and want to create custom capabilities for that, how do I do this? For example, I want to let my Editors to edit and create and delete posts and pages, but not the custom post type I've created? I also want to have the possibility to change the capabilities later with this plugin: http://...
Use <code> 'capability_type' </code> &amp; <code> 'capabilities' </code> when you <code> register_post_type() </code> .
Define new user capability for custom post types?
wordpress
If you have a category called "term" and a subcategory called "subterm", your can access subterm posts at /cat/subcat. But this doesn't work out of the box with custom taxonomies. They are accessible at /taxonomy/subterm, but not /taxonomy/term/subterm. They've gone over this in the Wordpress Trac ( http://core.trac.wo...
This is implemented in WordPress now as of 3.1. When you register your taxonomy , make sure to set rewrite hierarchical to true as well as the taxonomy itself: <code> &lt;?php register_taxonomy('genre',array('book'), array( 'hierarchical' =&gt; true, // this makes it hierarchical in the UI 'labels' =&gt; $labels, 'show...
How to enable hierarchical permalinks for hierarchical taxonomies
wordpress
I want to display a single random post out of the 5 latest posts in the category 'news'. The approach I'm using is this: <code> // Custom function to retrieve catgory ID by category name. $cat = $lib-&gt;getCatIDbyCatName('news'); // Retrieve the 5 latest posts $news = get_posts( array( 'numberposts' =&gt; 5,'category_...
<code> // Get a single random post from fetched posts $post = $news[rand(0, 4)]; setup_postdata($post); echo the_title(); echo the_intro(); // &lt;- Custom function to retrieve custom field </code>
Not able to get random post
wordpress
If I do a post or a page with no title, I'm left with an empty <code> h1 </code> tag at the top of the post/page. I'd like to either get rid of the <code> h1 </code> in these cases, or else be able to add an extra CSS class to the post/page so that I can specify how to display the post (and the <code> h1 </code> ) diff...
To add an extra class when there is no title <code> &lt;h1&lt;?php if(!get_the_title()){echo ' class="no-title"';}?&gt;&gt;&lt;?php the_title();?&gt;&lt;/h1&gt; </code> Or to only display h1 tags when there is a title <code> &lt;?php if(get_the_title()) { ?&gt; &lt;h1&gt;&lt;?php the_title();?&gt;&lt;/h1&gt; &lt;?php }...
Is there a way to specify an extra class for a post or page with no title?
wordpress
I'm having trouble with the 'Remote Login' option of MultiSite domain mapping. I have a local dev install which allows me to swap between network blogs without needing to login to each blog individually (which is my understanding of what Remote Login allows?). But the live version of the Network forces all users to log...
I wonder why there seem to be so few people having trouble with this. It's a major bug and thus I created the following ticket just now: https://core.trac.wordpress.org/ticket/18069 Not an answer, but just FYI.
'Remote Login' with MultiSite Domain Mapping still forcing users to login to all blogs individually?
wordpress
I have just started a programming blog and I am using the SyntaxHightlighter Evolved plugin to format my code. On most browsers this is working just fine. However if I attempt to view the site from either an iPhone or iPad the line numbers and code are no longer aligned. Basically the problem seems to be that the line ...
It turns out that the style sheet (style.css) for the Twenty Ten theme modifies the size of <code> pre </code> and <code> code </code> independently. This appears to be what is causing the problem. Moreover it increases the size of the fonts which causes them to be too big when compared to the rest of the text. These a...
Code Formatted with SyntaxHighlighter Evolved Appearing Incorrectly on iPad/iPhone
wordpress
I can't find any plugin or script to place a "report as spam" button in my comments section. The button could simply: - open a form to report a spammy or problematic comment to the admin - send an email or store in the db the problematic comment ID ready for being checked/deleted by admin. I have a lot of comments that...
There a a few plugins that allow visitors to report comments AJAX Report Comments Safe Report Comments
Report spam button
wordpress
I am actually displaying a number beside my comments putting <code> $counter = 0; </code> before wp_list_comments in comments.php and <code> global $counter; $counter++; </code> inside the comments callback function in functions.php Now this is working fine, but since I'm using threaded comments, my numbers are looking...
You can check if the comment has a parent and only count if not: <code> global $counter; if ($comment-&gt;parent == 0){ $counter++; } </code>
Numbering only parent comments
wordpress
What's the best practice for handling CSS on a theme with multiple page templates? For example: I will have a Full Width page template and a 2-column page template. Is it best to just call out the containers in a single CSS (#fullWidthContainer vs. #twoColumnContainer) Or is it better to have separate CSS files for eac...
This isn't really WordPress specific, but from the server perspective it would add additional http requests for visitors to load additional css files, versus pulling the same site-wide css file from cache. From a css perspective, I prefer to keep it all in one file. Some people prefer to organize things differently, li...
Multiple Page Templates & CSS
wordpress
I'm writing my own plugin. works like this: <code> function myfunc (){ $a = 'hello'; // the sentence what Am looking for: if ( user is logged and is the author of current post / page ){ $a= 'author'; } return $a; } </code> Wondering how I can do that sencence / function?
Just compare display names: <code> $currentuser = get_currentuserinfo(); if ( get_the_author() == $currentuser-&gt;displayname ) { // current user is the post author; do something } </code> The <code> get_the_author() </code> function returns <code> displayname </code> , which should be able to be compared against the ...
Show info to author only
wordpress
Im not sure if you guys have encountered this problem, but WordPress appends empty <code> &lt;p&gt; </code> tags before and after the body of text from the <code> comment_text() </code> function. Strangely, when you <code> echo get_comment_text() </code> or <code> echo $comment-&gt;comment_content </code> (same thing) ...
If you look in <code> wp-includes/default-filters.php </code> you'll see all of the functions each comment is run through before it's output. I'd guess it's the last one, wpautop, which adds p tags in place of line breaks: <code> add_filter( 'comment_text', 'wptexturize' ); add_filter( 'comment_text', 'convert_chars' )...
How to disable empty tags in comment_text()
wordpress
Every time I edit a WordPress post or page that has a google map embedded in it - useing the "visual" edit mode - wordpress deletes part of the data. for example: this <code> &lt;iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.com/maps/ms?ie=UTF8&a...
The issue is WordPress' core configuration of TinyMCE, which strips IFRAME tags. You can modify this configuration, to allow IFRAME tags, by hooking into <code> tiny_mce_before_init </code> . For example, the following code will prevent TinyMCE from stripping IFRAME, PRE, and DIV tags: <code> function mytheme_tinymce_c...
WordPress keeps altering my embed code
wordpress
How can I add a CSS Class to the <code> previous_post_link </code> output or just get the URL and create the HTML markup myself
You can use the more native function that is "below" the <code> previous_/next_post_link(); </code> : <code> # get_adjacent_post( $in_same_cat = false, $excluded_categories = '', $previous = true ) $next_post_obj = get_adjacent_post( '', '', false ); $next_post_ID = isset( $next_post_obj-&gt;ID ) ? $next_post_obj-&gt;I...
How to add CSS Class to previous_post_link or get previous/next post link URL
wordpress
Is there a way to show a list of all categories available even if there are no posts associated with them. So if there is a post in that category then it echos a link and if not it just echos out the name of the category? I'm using wp_list_categories() to show them...
There's an argument called <code> hide_empty </code> which is true by default. <code> $args = array('hide_empty' =&gt; FALSE); wp_list_categories($args); </code> Codex: http://codex.wordpress.org/Template_Tags/wp_list_categories
Show list of categories even if they have no posts
wordpress
I created 1 custom post type with 2 custom taxonomy. Installed http://wordpress.org/extend/plugins/json-api/ and tried to reach result with: http://example.com/api/get_recent_posts?dev=1&amp;post_type=myposttype well it gives me custom posts but not giving those post's custom taxonomies "categories": [], "tags": [], Ho...
I would have done it as following, I am sure experts here will have a better way but following is what I could come up with in hurry. First create your controller file in your theme directory (or any other if you like) with the following content. For this example the file name is korkmaz.php UPDATE 1: Please replace th...
wordpress json custom taxonomy problem
wordpress
i am using the Smart Youtube plugin for wordpress to show youtube videos. This works fine on my main site. But when i click on a view by a certain tags, none of the video show up in the blog entries. so when i view: http://mysite.com it works fine and when i view an individual post like: http://mysite.com/?p=3580 , it ...
edit tag.php (or archive.php if tag.php does not exist) and look for <code> the_excerpt(); </code> - exchange it with <code> the_content(); </code> codex the_excerpt() codex the_content()
videos not showing on my tag pages
wordpress
This is going to be tough to explain. I have created a custom theme and have a file called: categories.php, in this file i have: <code> &lt;?php $args = array('hide_empty' =&gt; FALSE); wp_list_categories($args); ?&gt; </code> This displays all my categories as links, even the ones without a post associated with them. ...
if category.php does not exist, make a copy of archive.php or index.php and save it as category.php; then, before the start of the loop, add: <code> &lt;?php global $query_string; query_posts( $query_string . '&amp;posts_per_page=-1'); ?&gt; </code>
Display all posts from selected category
wordpress
I am moving my site from olddomain.com to newdomain.com. I want to keep all of the content at olddomain.com but I want the canonical version in google to be recognized as newdomain.com/whatever-post/ instead of the same thing at olddomain.com. How can I modify the rel=canonical in the section of olddomain.com to make t...
Unfortunately, there's no filter in the <code> rel_canonical() </code> function. But you can remove that function from wp_head altogether and write your own. Try adding this to the functions.php at your old domain: <code> remove_action( 'wp_head', 'rel_canonical' ); add_action( 'wp_head', 'new_rel_canonical' ); functio...
Custom Canonical URLs
wordpress
I'm in need of the ability to allow anyone (they don't have to login) to fill out a form with email and a textarea and submit it to my site. This form would be treated as a post and appear somewhere for me to moderate. If i hit publish, it would be published to my site like any other post i wrote. Is there a plugin tha...
This might work for you? http://perishablepress.com/user-submitted-posts/
Allow anonymous users to post to my site for moderation
wordpress