question
stringlengths
0
34.8k
answer
stringlengths
0
28.3k
title
stringlengths
7
150
forum_tag
stringclasses
12 values
I'm trying to determine what my image processing workflow should look like. I know WordPress automatically resizes and compresses images to various different sizes on upload. I'm curious if it does any compression on the original image. Since it's doing compression (as it should) on the smaller images, I wouldn't want ...
This is all I can get from reading the source code for the <code> wp_handle_upload </code> function in <code> wp-admin/includes/file.php </code> . WordPress keeps the original uploaded file (usually) - see below... WordPress does apply JPEG compression to resized images when the source is a JPEG. The default JPEG compr...
When Uploading JPEGs, Does WordPress Compress the Original Image?
wordpress
I'm trying to target my landing page with is_front_page or is_home in my page.php file but it's not working. I have set the settings > reading to a static page. However, if I create a page-home.php everything works fine (without the tags of course). But, if I use the is_front_page or is_home on the index file they will...
Ok, if you take a look at implementation of <code> is_front_page </code> , you will see the following: <code> /** * Is the query for the front page of the site? * * This is for what is displayed at your site's main URL. * * Depends on the site's "Front page displays" Reading Settings 'show_on_front' and 'page_on_front'...
page.php – is_front_page NOT WORKING
wordpress
I was attempting to add this Flash Count Down plugin . The shortcode works fine in preview: But when published the shortcode is rendered as text: Is there a general solution to this problem or do I have to get someone from the publisher to answer this question? They have apparently abandoned supporting these as their l...
find the function that generates the output, or the output itself if it's hardcoded in your page and add this function to it: <code> &lt;?php echo do_shortcode( $content ) ?&gt; </code> if your content is generated through the_post(), it'll be: <code> &lt;?php echo do_shortcode( the_post() ) ?&gt; </code> or the_excerp...
Plugin renders in preview but shortcode shows when published
wordpress
I have been using stackexchange-url ("this") question to try to do this but I am having some difficutlty. I have a custom post type, media, and I am working on the archive-media.php template. I have it partially working in that when I delete the if condition out of the code it does add the class, but of course to every...
I realised that $wp_query doesn't work for where I had customised the queries with <code> WP_query </code> . This is completely obvious I suppose when you know, but I didn't, so here is the adjusted code in case it benefits some other amateur! Note that $media_query, $events_query etc are the instances of <code> WP_que...
CSS class on last post in loop ( custom query )
wordpress
I want to overwrite the "metaWeblog.newMediaObject" xmlrpc call so the file is saved remotely. From mw_newMediaObject in class-wp-xmlrpc-server.php, i see that there is a hook: <code> do_action('xmlrpc_call', 'metaWeblog.newMediaObject'); </code> So I should be able to do something in my plugin like: <code> add_action ...
Actually, that hook just lets you tie in to the beginning of executing that function, it doesn't let you override anything. If you want to replace this function entirely, I recommend two different options: 1. Don't use it Just define your own XMLRPC method ( <code> myNamespace.newMediaObject </code> ) and call that ins...
Overwrite default XMLRPC function from plugin
wordpress
I'd like to make my most recent article display a large with a larger thumbnail and with more content, while the rest of the posts in the loop show a small thumbnail and only the title with no content. Is there a way I can do this in one <code> while(have_posts()) </code> loop?
check the built in counter <code> $wp_query-&gt;current_post </code> within the loop: <code> &lt;?php while( have_posts() ) : the_post(); if( 0 == $wp_query-&gt;current_post ): // this is the first post in the loop, output larger size, full content, etc. else: // output regular size, the_excerpt, etc. endif; endwhile; ...
Different style for most recent article
wordpress
I consider myself fairly versed in this matter, however I've recently had a rash of issues when moving sites. I am able to successfully move the site, edit wp-config.php, move the database, etc. Once I've moved the database, I then execute these queries: <code> UPDATE wp_options SET option_value = replace(option_value,...
There are some instances of serialized data in the database, notably in things like widget options, that become invalidated if you do a blind search-and-replace without accounting for different string lengths. You might try a tool like this one to do a search and replace that also handles serialized data: http://interc...
Proper approach to moving complete site from one domain to another AND preserve widgets
wordpress
I'm trying to save if a checkbox inside of the media uploader pop up is checked, so i can retrieve it from the front end. I'm using this code: <code> function filter_attachment_fields_to_edit( $form_fields, $post ) { $foo = (bool) get_post_meta($post-&gt;ID, 'foo', true); $form_fields['foo'] = array( 'label' =&gt; 'Is ...
The field id has to match in both function so if your field id is <code> foo </code> the when you save you need to look for that id and when you save a checkbox field its smart to remove it if not set so: <code> function image_attachment_fields_to_save($post, $attachment) { if( isset($attachment['foo']) ){ update_post_...
How do i save and retrieve custom attachment meta?
wordpress
Im writting a plugin who makes dynamic pages with simple page template: http://domain.com/slug the url is rewriting so internally call to http://domain.com/index.php?pagename=users and works, but the problem is, how I can index it to make searches? Any ideas?
Do you have at least have a link to the query url somewhere on your public pages ? Google does follow query parameters, so that will at least bring it to the crawlers attention. See http://googlewebmastercentral.blogspot.com.au/2011/07/improved-handling-of-urls-with.html (I almost have the opposite with my event/calend...
dynamic page not indexed
wordpress
All I am using wordpress custom menu, and there is one menu as Logout. I know wordpress Logout function <code> &lt;?php echo wp_logout_url(); ?&gt; </code> But how can i use it in custom menu ?
Not sure how and where you can create a custom button, but you can add such a link per filter: Add a 'wp_nav_menu_objects' </code> and insert the link where you need it. Here is a basic example: <code> add_filter( 'wp_nav_menu_objects', 'wpse_46547_add_log_out_link', 10, 2 ); function wpse_46547_add_log_out_link( $sort...
How to use logout function on custom menu link?
wordpress
I have a site with multiple custom post types and taxonomies. The taxonomies are shared across all of the post types. On the archive page of the 'videos' post type, I want to show a list of all of the 'country' tags that are associated with videos. When this link is clicked on, I'd like to be able to go to an archive f...
I've worked out a solution to this. I hope this can help someone else. First add the following two functions to your functions.php (or plugin) file: <code> function get_terms_by_post_type( $taxonomies, $post_types ) { global $wpdb; $query = $wpdb-&gt;prepare( "SELECT t.*, COUNT(*) from $wpdb-&gt;terms AS t INNER JOIN $...
How to show a tag archive of one post type only
wordpress
I just use the pages for navigation. I don't need the menu bar that has the single item - uncategorized. Here is the link to the theme being used. http://themeforest.net/item/deadline-premium-wordpress-news-magazine-theme/faq/117203 Is this a theme issue or part of the word press core?
This might be better directed to the theme developer, as there may be an even easier way of doing this, but there are 3 basic methods to remove a menu: Unregister the menu This might cause issues with the <code> wp_nav_menu() </code> call, but you can use <code> unregister_nav_menu() </code> to remove the menu. You wil...
How do I remove this menu bar?
wordpress
I'm going to build my first Child Theme. I understood how to override functions (hope!), but how to override variables? For example, in a Premium Template I want to change the values of feed variables shown in functions.php: <code> $app_rss_feed = 'http://xxx.rss'; $app_twitter_rss_feed = 'http://yyy.rss'; $app_forum_r...
I'm mobile, so this will be short. Use the after_setup_theme hook to add a function to set those variables. Declare them as global inside that function before setting them. Hope that helps. If anybody wants to add an example to this answer before I get home, feel free. ;)
Child Theme: how to override variables?
wordpress
Im using the buddypress likes plugin and I'm using a code to show the like count for posts on the index page of my site. The problem Im running into is the Like count only shows if you've liked the post and then it shows the total number. If you're logged out you won't see any like counts. How can I show the Like Count...
You are using the <code> count() </code> function to determine <code> $liked_count </code> . This function is meant to determine the number of items in an array. But it appears that the value stored in the <code> liked_count </code> postmeta is not an array, but an integer count. When you do <code> count( $p ) </code> ...
Make buddypress posts likes count show to all users
wordpress
For some reason, tonight when I have gone to work on my Wordpress installation I firstly found myself logged out, even though there was a few cookies left in Firefox relating to the website and when I looked on the Simple:Press forum it had remembered my user name but knew I wasn't logged in. Nevertheless, I logged in ...
This will happen occasionally on both Firefox and Safari when cookies don't match. Sometimes, WordPress will store an auth cookie and, for some reason, won't read data back out of it. This leaves you in a weird place of being semi-logged-in. If you flush your cookies for the site, it should rectify the problem. Either ...
I keep getting logged out in Firefox
wordpress
here is the simple PHP template system i have found The Class (template.class.php) <code> &lt;? class Template { public $template; function load($filepath) { $this-&gt;template = file_get_contents($filepath); } function replace($var, $content) { $this-&gt;template = str_replace("#$var#", $content, $this-&gt;template); ...
My first answer to your question is another question: Why? PHP is a template language. You need this separation only in cases where the Designer and the programmer have two very different jobs. But someone writing WordPress themes has to know PHP anyway: Just look at the custom header and background set ups, at <code> ...
PHP Template way of coding for wordpress theme development
wordpress
Is there a way to use the same database, tables and all, with two different domains? For example, two employees each have thier own subdomain to develop / test with, so there may be two instances of a site: <code> jack.example.com/test_blog/ jill.example.com/test_blog/ </code> however, since the base url is stored in t...
Turns out that instead of relying on the Database for a URL, you can set it in the config file, which solves the problem I was having, like so: <code> define('WP_SITEURL','http://jack.example.com/test_blog/'); </code> and then I set use a different config file for the other instance. soruce: http://codex.wordpress.org/...
Use one Wordpress database with multiple instances of one site
wordpress
I am trying to modify the Group Description field on Buddypress Groups so that they can take HTML but Buddypress has filters to prevent this. I used this; remove_filter( 'bp_get_group_description', 'bp_groups_filter_kses', 1 ); remove_filter( 'groups_group_description_before_save', 'wp_filter_kses', 1 ); These are the ...
The key filter is <code> force_balance_tags </code> . Don't remove that one, as it's responsible for making sure that HTML tags are closed.
Allowing users to add HTML to BP Groups Description how can I error check html of users?
wordpress
Is there a way to edit the text "thank you for creating with Wordpress" in version 3.3.1 at the bottom of the CMS? If so what file do I need to edit?
Credit definitely goes to @kaiser, but here you go: <code> function wpse_edit_footer() { add_filter( 'admin_footer_text', 'wpse_edit_text', 11 ); } function wpse_edit_text($content) { return "New Footer Text"; } add_action( 'admin_init', 'wpse_edit_footer' ); </code>
Edit "thank you for creating with Wordpress" in version 3.3.1
wordpress
www.net2ftp.com shows my permissions to be <code> rwxr-xr-x </code> for the top level directory which I aptly named wordpress ( test site ). This would be for ( user | group | other ) and ( read | write | execute ) so that I have write permissions if I am " user ". I am of course logged into wordpress with the only acc...
This is more of a system configuration question, but still ... On the server, everything is locked down based on users and user permissions. You are a user. Your FTP account is a user. Your root account is a user. WordPress itself is a user. So while you as a user might have write permissions for the WordPress director...
Permissions for installing themes and files in general?
wordpress
It is possible to create tabs in admin panel in Theme options like in Theme? Please see this screenshot: I can't find any official documentation about adding admin tabs.
Wordpress includes many js libraries in <code> \wp-includes\js </code> and in <code> wp-admin\js </code> . You can browse through them and choose which one you want, including jQuery tabs. You can use it in your theme by using this function, http://codex.wordpress.org/Function_Reference/wp_enqueue_script To figure out ...
WordPress theme options tabs
wordpress
Can I prevent enumeration of usernames on my wordpress site? I can see users at the moment using the WPScan tool.
A simple solution I use in a <code> .htaccess </code> : <code> RewriteCond %{QUERY_STRING} author=\d RewriteRule ^ /? [L,R=301] </code> It is similar to @jptsetme’s answer, but it works even when the query string is <code> /?dummy&amp;author=5 </code> , and the search pattern for <code> RewriteRule </code> is very fast...
Can I Prevent Enumeration of Usernames?
wordpress
I've recently upgraded to version 3.3.1 and noticed a nice feature that would be great for our non-Wordpress savvy clients - creating a tour of how to use Wordpress. I've used the Yoast SEO plugin for a long time and they've added a tour feature, which when you click the next buttons it goes through the various feature...
If you look at this plugin I wrote as a demonstration on using pointers, you will see how to create them and have them close correctly: https://github.com/Tarendai/WP-Pointer-Pointers This plugin creates 'pointer pointers':
Is it possible to create a Wordpress tour? V3.3.1
wordpress
Wordpress Codex says : Make sure to end your structure with either <code> %post_id% </code> or <code> %postname% </code> (e.g. <code> /%year%/%monthnum%/%day%/%postname%/ </code> ) so that each permalink points to an individual post. But I would like to set my website's permalink structure (to suite the Google News URL...
In a word, No. As long as you have <code> %postname </code> somewhere in there you should be fine. Having it at the end, beginning, or middle shouldn't matter. Although the Codex is a great resource it's also edited and written by other WordPress users.
Is the '/category/post-name-date/' permalink structure okay?
wordpress
after setting up the wordpress htaccess rules in my vhost, i was unable to enter the wp-admin area. I was always redirected to the frontpage of my wordpress instance. The rewriting itself worked on the mainpage. All links worked so far, but the admin area remains without any access. Rewrite rules used: <code> RewriteEn...
OK, so the initial Problem was: <code> How to get the Rewrite Rule working at a VHOST Environment </code> and the answer - if unknown - was a little tricky. RewriteBase doesn't work on a VHOST. The Solution is to put all those Rewrite-Stuff at a Directory-Section like this: <code> &lt;VirtualHost *:80&gt; ServerName ww...
Rewrite-Rules not working on a vhost, everything goes to index.php
wordpress
I have been trying to achieve the following url structure in Wordpress and maintain a level of reusability in the admin area. It is for a client preview area and needs to reflect multiple versions of different file types. So the desired URL structure would be: http://preview.mysite.com/client-name/wireframes/v1/homepag...
My gut feeling is that you want to use custom taxonomies for part of this. So client-name would be one taxonomy (flat), version would be another taxonomy (also flat). Wireframes might a post type or a taxonomy, not sure what makes sense for you. A little googling led me to the following links, that you might be able to...
Best structure / rewrite rules to achieve the following url
wordpress
I want to insert a few video tutorials in the wordpress dashboard, instead of creating a pdf manual for a client, as i think they are easier for this client, how would I go about that? I am thinking of having like 4 videos in the dashboard. Where would be the best place to host them as well, in order to keep them priva...
I do exactly that with my clients! PDF's are much harder to assemble &amp; nobody Reads The F Manual, anyway :) And, if you allow me a little digression, I'd recommend this talk about e-learning and video tutorials: Salman Khan: Let's use video to reinvent education . Dealing with Privacy YouTube offers two possibiliti...
Video tutorials in Dashboard
wordpress
I am trying insert the title of a post in the option value of a form for paypal purchase, so I know what item they have chosen. But when I do this paypal gives me a error message that something is wrong with my site. Am I doing this wrong I am trying to insert the title of a post in a option value below. <code> &lt;for...
why not pass the title as another hidden input? doesn't seem like much reason for a select element when you only have 1 option. <code> &lt;input type="hidden" name="on0" value="&lt;?php the_title();?&gt;"&gt; </code>
I am trying to grab the title and put it in a paypal form select option
wordpress
I want to show the last 5 comments for each post on my index page loop of posts. What Im using now is only showing the same comments for every post. How should I set this up and how can I add an avatar to each comment. What have this obviously isn't working.. <code> &lt;?php $args = array( 'status' =&gt; 'approved', 'n...
You should place your code inside the loop and add to the <code> args </code> array <code> 'post_id' =&gt; get_the_ID() </code> so it should look like this: <code> while(have_posts()){ the_post(); //your post loop output $args = array( 'status' =&gt; 'approved', 'number' =&gt; '5', 'post_id' =&gt; get_the_ID() ); $comm...
show list of latest comments for each post in a loop
wordpress
I am planning to build a portfolio using custom post types, so the main portfolio page will show a "featured" image for each portfolio post. Once you click on one of these images you will go to the actual post page for that portfolio item. Once on this page I would like to show multiple images for this particular portf...
A simple solution would be to use the featured image (post thumbnail) as image for the portfolio listing and for the item itself you can use the native gallery with its shortcode: <code> [gallery] </code> . Also if you'd like to use some kind of lightbox with it you can look/use the plugin <code> jQuery Lightbox For Na...
How to show multiple images in a slideshow for a portfolio page
wordpress
in an example of the Settings API, there's an input and the callback function to sanitize/validate the result from this input : this is the input : <code> echo "&lt;input id='text_string' name='boj_myplugin_options[text_string]' type='text' value='$text_string' /&gt;"; </code> and this is the callback function : <code>...
You sanitization callback function get passed all the values that correspond with the setting name. When a POST request is made to the <code> options.php </code> file from the page on which your settings resides, WordPress calls your sanitization callback in a way that would resemble this: <code> &lt;?php boj_myplugin_...
settings api and the data passed in the parameter
wordpress
Ok i found the code to change the "TAGS" to another name.. I changed my tags to say "Celebrities" but the permalinks still says TAGS i want it to say "Celebrities" how do i do this. Here is the code i use <code> add_action( 'init', 'wpa4182_init'); function wpa4182_init() { global $wp_taxonomies; // The list of labels ...
You can set your tag base differently in the admin area: <code> Settings &gt; Permalinks </code> then at the bottom there is a field for "Tag Base". Enter "celebrities" in that field and your tag pages will be <code> yoursite.com/celebrities/some-celeb-name </code> . As far as why that is, it's because the write rules ...
How do i change the tags and taxonomies
wordpress
I'm truly stumped here. I have a specific taxonomy for sorting posts into different types of "featured" posts on a news site. Here's the problem: When querying by them the results aren't what they should be. Here's what I have: <code> $featured_loop = new WP_Query( array( 'featured' =&gt; 'home-featured', 'posts_per_pa...
Turned out to be a silly mistake, of course. If you look closely you see <code> $featured_loop-&gt;the_post(); the_post(); </code> . Which means that <code> the_post(); </code> was repeated, accidentally. Glad that's fixed!
Custom taxonomy in WP_Query not working
wordpress
I am using the following code to add a contact form to my template, but this code as is breaks the page. It just shows a white page when I add this code. Am I doing it wrong. <code> &lt;?php [contact-form-7 id="181" title="Contact form 1"] ?&gt; </code>
Well without more code it's hard to tell but one thing is you are wrapping a shortcode with php tags. My guess is you have error logs turned off or you'd see <code> Santax error unexpected '[' on line XXX </code> If you are using the post/page editor you want to use <code> [contact-form-7 id="181" title="Contact form 1...
When I try and use contact form 7 it breaks my page
wordpress
I'm having an issue thinking today and ran into a brick wall. What I'm trying to do it take 3 different custom field data for posts and combine them into an array that I can then json encode for use in some jquery. The three fields I want to use are the 'project title' and a custom field of 'latitude' and 'longitude'. ...
If I'm understanding your issue correctly, and if by 'project title' you mean the content of the <code> post_title </code> field, then it'll look something like this: <code> $post_data = array(); $my_query = new WP_Query( $whatever_your_args_are ); if ( $my_query-&gt;have_posts() ) { while ( $my_query-&gt;have_posts() ...
Create an Array of Specific Custom Post Meta
wordpress
I am using a new blog on WPMS (3.0.1, updating is not an option) to aggregate posts (and their featured image) from a few blogs on the same install, and I have to do it programmatically rather than through a pre-made plugin due to firewall restrictions. I've tried several ways of doing it, and feel like stackexchange-u...
It turns out I was barking up the wrong (or at least a slightly different) tree by using wp_insert_attachment. media_sideload_image managed to pull attachments from other blogs on the same multisite install, copy them to the aggregating blog's uploads directory, and generate thumbnails, while wp_insert_attachment was d...
why when I try to insert an image attachment along with a post does wp_get_attachment_url give me a very wrong file path?
wordpress
I'm attempting to create a "related posts" section on pages using query_posts. I'm wanting to use this simply because we want to show random posts from one category on one page, so a plugin would be overkill. The problem I'm having is dynamically excluding the current page the user is on from the list. Here's the code ...
In your code, if <code> $post_id </code> were, say, 99, this: <code> query_posts("showposts=4&amp;post_type=page&amp;post_parent=168&amp;orderby=rand&amp;exclude='. $post_id .'"); </code> would result in this being passed to query posts: <code> query_posts("showposts=4&amp;post_type=page&amp;post_parent=168&amp;orderby...
Dynamically excluding current page id
wordpress
I'm currently creating a new template for a client. Their current template does not implement menus at all. They are all hard coded links in the template. The new template I making them will implement the menu functionality. Their menus are fairly extensive (around 50 links). Since the menu option does not currently sh...
All you need to do is enable custom menu's by creating a functions.php in your current theme, and or if it already has a functions.php file, you just need to add this: <code> add_theme_support( 'menus' ); </code> And you will be able to add menus before making them live.
Setting up menus before making a template live
wordpress
Is it possible to allow BP Group Admins to Set which Menu Tab they would like to have as their Default landing page when people enter their Group like Activity Stream or Documents etc?
You can do it programmatically like this: stackexchange-url ("What&#39;s the easiest way to change the default landing page for BuddyPress groups?") The answer there could be expanded into a plugin that would provide a UI for group admins (and a means of storing preferences on a group-by-group basis), though this would...
Is it possible to allow BP Group Admins to Set which Menu Tab they would like to have as their Default landing page?
wordpress
Does wordpress create any dated logs of activity? ie core updates, plugin download dates etc?
No, it doesn’t. You could hook into the appropriate filters and save the information in an option or in a custom post type. I would log updates to PHP, MySQL and the server software too. Would be an interesting project. :)
Does wordpress create activity, update logs?
wordpress
I have a custom post type with only 3 custom fields in it. <code> $post_types = get_post_meta($post-&gt;ID,'post_types',true); $post_taxonomies = get_post_meta($post-&gt;ID,'post_taxonomies',true); $post_terms = get_post_meta($post-&gt;ID,'post_terms',true); </code> I want to check if already exist post with this $post...
Checking if meta values exist You can use <code> get_posts() </code> (or the <code> WP_Query </code> object) to query all posts which match the post meta you want to save. You will need to specify the post status (i.e. which statuses are you willing to ignore). Below is the untested code to this. (For completeness I've...
Check before publishing, if already exist post with current custom field value
wordpress
<code> jQuery.ajax({ type: "POST", url:"wp-admin/admin-ajax.php", data:'action=nafham_list_cats_selection&amp;selection_id=' + $selection_id, success:function(results){ jQuery(".semester_selection").empty(); jQuery(".semester_selection").prop('disabled', false); jQuery(".semester_selection").append(results); } }) </cod...
Instead of passing two parameters to function you can pass the array of two values like this : <code> $results['args1'] = "value1"; $results['args2'] = "value2"; echo json_encode($results); </code> and then get it in success function like this : <code> success:function(results){ jQuery(".semester_selection1").append(re...
How to use ajax to get multiple outputs?
wordpress
I have a custom home page ( <code> home.php </code> ). I want to show the original home page's posts on <code> /blog/ </code> . I created a new blog.php file, with Template Name: Blog, added <code> query_posts('numberposts=5&amp;paged=' . get_query_var('paged')); require dirname(__FILE__) . '/index.php'; </code> to the...
Don't do it this way. <code> query_posts() </code> should not be used most of the time and you are really hacking things up here with direct template inclusion and such. Create new page Blog (no template). Go to <code> Settings </code> > <code> Reading </code> . Assign this page as <code> Posts page </code> .
query_posts call sets is_home() to true
wordpress
Does anyone know of a plugin that lets you customize the heading area of each page or post with HTML? The heading area I refer to is directly above the main post content. An example is on http://www.woothemes.com/affiliates/ If you look in chrome developer tool or firebug, this div tag is their page-heading, below this...
You could use a simple custom field and have it displayed on the page template. Assuming you name the custom field "page-heading" this could help you: <code> &lt;?php query_posts(); ?&gt; &lt;?php if(get_post_meta($post-&gt;ID, 'page-heading', true)): ?&gt; &lt;?php echo get_post_meta($post-&gt;ID, 'page-heading', true...
Custom page html headings plugin?
wordpress
I would really like to know: Is there any fundamental difference in developing a multi-network site as opposed to a normal wordpress site? More Specifically: Is the wordpress plugin development process the same? Is theming the same? Can I use common AND separate stylesheets? Will my old WP queries continue to work the ...
Essentially, a WordPress network is number of almost totally unique sites which answers most of your questions: you can proceed as you normally would. The network allows you to share the database and file system, but each site is unique and the only main feature shared between each network site is the user system. To a...
Is there any fundamental difference in developing a wordpress multi-network site?
wordpress
I want to create a Interactive google map as per http://www.rightmove.co.uk/property-for-sale/map.html?locationIdentifier=REGION%5E93932 .. I just wanna ask if I can do that using wordpress plugin, or can I have that kind of fucntionality even without using wordpress plugin? but how?.. here are the details.. any tip pl...
I'm not sure to understand what you want here... You want something like yelp on the right? ( here ) That will update the website when you change your map boundaries? Edit: I think you should look at this plugin . Is it this?
Google Map Integration
wordpress
Hope you can help a WP newbie :) It is my understanding (and please correct me if I'm wrong!) that I cannot use the same subcategory slug in multiple parent categories, i.e. this structure is impossible with WP's category functionality: <code> example.com/design/exotic/my-post/ example.com/travel/exotic/another-post/ <...
The only possible way I can think to achieve this would be through getting neck deep in rewrite rules. You would have to flip your actual category structure around so that 'exotic' is the parent category, with two subcategories, 'design' and 'travel'. Obviously you would put any posts you wanted in <code> /design/exoti...
"Reversable" and "Re-useable" Subcategories (or other taxonomic structure)
wordpress
The exact error is: Call to undefined function <code> get_userdata() </code> in /wp-includes/query.php on line 3567 I am using <code> get_posts() </code> in my plugin, which in turn uses <code> setup_postdata() </code> wherein <code> get_userdata() </code> is executed. I have no clue what's going on. I looked at <code>...
Your problem is that you're adding a <code> return new CLASSNAME( $data ); </code> at the end of a file(?). You need to make that call inside a function and add the fn callback to a hook like this: <code> // THIS IS ONLY AN EXAMPLE! function wpse46288_call_the_funk() { return new CLASSNAME( $data ); } add_action( 'init...
Calling setup_postdata() causes "Call to undefined function get_userdata()" error?
wordpress
I have a front end uploader for members only, utilizing this code: <code> &lt;?php function insert_attachment_form($postID) { ?&gt; &lt;form id="file-form" name="file-form" method="POST" action="" enctype="multipart/form-data" &gt; &lt;input type="file" id="async-upload" name="async-upload" /&gt; &lt;input type="hidden...
Yes, yes you can You will need to hook into the <code> add_attachment </code> action, though there are others that may be more appropriate. Then you grab the list of administrators and send an email. Here is a sample plugin I created for you: <code> &lt;?php /* Plugin Name: Notify on Attachment Creation Plugin URI: htt...
Can I get an email notification when media is uploaded to the media library?
wordpress
Currently I have my comments set so that when you hit "reply" to a comment, it will insert <code> @USERNAME </code> of the person you are replying to. I am trying to find out if wordpress emails that user to let them know that I have replied to a comment they left or if this is something I will have to manually code in...
It doesn't automatically send out emails. You can install a plugin to do that, however. There are quite a few listed in the WordPress plugin repository: http://wordpress.org/extend/plugins/search.php?q=reply+to+comment Hope this helps, best of luck!
Does a reply to a wordpress comment notify the author of the comment?
wordpress
I apologize if this is mentioned on here but I can't find any information! Anyway, I am building a WordPress site where I created the content with my administrator account. However, once the site is launched there are going to be 10-15+ Author accounts in order to manage a single custom post each. Is there any way that...
There's a capability that's named <code> edit_others_posts </code> , that you can assign to users or roles. But there's also an easier way to do this: The (by default) hidden "Author" meta box. How-to change the author of a post 1. Click the "screen options" tab on the upper right of the admin screen. 2. Check the "Aut...
How to Add Author Editing Capability to Existing Post by Admin
wordpress
Is there a way I can stop Wordpress auto formatting everything I enter inside a shortcode tag? A the moment I want to include a h2, a paragraph and another shortcode, but everytime I do Wordpress wraps each different elemnt in p tags. Is there a way to remove this so I can format each part individually?
You can postpone the <code> wp_autop </code> filter which is responsible for wrapping elements in P tags till after shortcodes are rendered: <code> remove_filter( 'the_content', 'wpautop' ); add_filter( 'the_content', 'wpautop' , 12); </code>
Stop auto formatting in shortcodes
wordpress
I'm new to WP and PHP and I'm trying to convert my 'old' HTML theme into a WP theme. I created my index.php page and linked it to the style.css. I have some images in the css and, from what I've read, I've understood that I have to change my image url so that instead of having: <code> background-image: url(../assets/Lo...
If your style.css is in <code> /wp-content/themes/themedirectory </code> , and your image is at <code> /wp-content/themes/themedirectory/images/image.jpg </code> , then your css will be this: <code> background-image: url("images/image.jpg"); </code> You can't use php in a css file, it will not parse unless included via...
CSS images don't show up with bloginfo
wordpress
I've created a menu for each section of the site, and I'd like the sidebar to only show the relevant menu to pages in a section, so the 'About' page and its children receive the about menu and the 'Advice' page and its children the advice menu, and so on and so forth. I've got this working for parent pages but I can't ...
Bainternet's solution will definitely work, but it you want to use the page slug instead of ID you could put this in your functions.php file: <code> // GET PAGE ID FROM THE SLUG, HELPER FUNCTION FOR IS_TREE function get_ID_by_slug($page_slug) { $page = get_page_by_path($page_slug); if ($page) { return $page-&gt;ID; } e...
Conditional sidebar menu
wordpress
I have a widget area in my header. How can I have that display a different widget depending on what group is shown? So if uses are in a group about say Baseball in the site Header in my theme the Widget on Baseball shows up but if the user is in a group on Golf then the header shows a widget I have for Golf? Can this b...
You could install widget logic and add something like <code> bp_is_groups_component() &amp;&amp; 'your-group' == bp_current_item() </code> in a widget's widget logic area. The widget logic content filter feature looks like it could create something a bit more sophisticated than the above
I have a widget area in my header. How can I have that display a different widget depending on what group is shown?
wordpress
question: I am trying to create a new sub nav item for the groups on buddy press I am using <code> bp_core_new_subnav_item </code> to do it and passing the <code> screen_function </code> , but the tab is not displaying on the group page Any ideas where I should be looking on this? Heres our code. <code> bp_core_new_nav...
Make sure that you only attempt to set up the items after BP has set up its core navigation. You can ensure this by hooking to <code> bp_setup_nav </code> with a priority higher than <code> 10 </code> . Thus: <code> function bbg_setup_nav() { bp_core_new_subnav_item( array( 'name' =&gt; 'Document List', 'slug' =&gt; 'g...
I'm trying to Add a new Buddypress menu tab and it is not showing up
wordpress
I don't think this is a parameter in get_comments( $args ); so I'm using a SQL statement. First I obtain a comment date from a separate table I created. Afterwards, I want to retrieve all comments made after that date. <code> $last_updated_comment = " SELECT comment_date FROM wp_last_comment ORDER BY comment_date DESC ...
This a php syntax error, try: <code> foreach($last_updated_comment as $key =&gt; $last_comment_date){ print_r( $last_comment_date ); echo "&lt;br /&gt;&lt;br /&gt;"; } </code>
Get comments after specific date
wordpress
I'm using 2 extra TinyMCE editors on my pages to add extra textfiels in my theme pages. I now realize that the auto-embed feature is not supported on content delivered thought custom fields. So i need to tell WordPress to enable this on these two extra custom fields. Here is an example of the back-end part included in ...
You're probably best off using <code> echo apply_filters( 'the_content', html_entity_decode( $monster_tiny_1 ) ); </code> instead of <code> echo wpautop(html_entity_decode($monster_tiny_1)); </code> and similar, which will run the autoembed behavior.
Auto embeding Vimeo/Youtube in custom fields (tinyMCE editor)
wordpress
I'm working on a news site built with Wordpress, and I now want to add a page for subscriptions. This will be paid subscriptions for the printed paper that people can get delivered to their home . My question is: is there a Wordpress plugin already created for this (free or paid)? I wouldn't really want to re-invent th...
You can use this plugin http://wordpress.org/extend/plugins/s2member/
Wordpress plugin for mail subscriptions
wordpress
I want to insert following custom code in single.php can I set condition that if specific taxonomy exist then show and work this code otherwise not; <code> &lt;div id="archivebox"&gt; All courses in&lt;?php echo get_the_term_list($post-&gt;ID,'country', ' ', ' ', '' ) ; ?&gt;&lt;br&gt;All courses in&lt;?php echo get_th...
If you want to check for the existence of a taxonomy, use <code> taxonomy_exists( $taxonomy ) </code> : <code> &lt;?php if(taxonomy_exists('country')){ echo 'All courses in' . get_the_term_list($post-&gt;ID,'country', ' ', ' ', '' ); } ?&gt; </code> etc... Edit If, instead of checking for the existence of a taxonomy, y...
If taxonomy exists then to show some code
wordpress
I like the simplicity of wordpress and all it has to offer, but for security purposes I would like to change the actual (or viewable) directory structure of my site. The install has a set of files that everybody who's familiar with wordpress will know about. I have read about some security measures some where that sugg...
This has been answered many times. Search this site, as toscho points out above. And see Ben Word - Hide WordPress , who shows how to: 1 - Clean up the output of wp_head and removing the generator from RSS feeds 2 - Hide /wp-content/ by rewriting static theme assets (CSS, JS, and images), rewriting the plugins director...
Change the actual (or viewable) Wordpress directory structure
wordpress
Currently I have the following loop: <code> &lt;?php $shows_sales = get_posts(array( 'post_type' =&gt; 'show_sale', 'post_status' =&gt; 'publish', 'posts_per_page' =&gt; 3, )); $done_image = false; ?&gt; &lt;ul&gt; &lt;?php foreach ($shows_sales as $post) : setup_postdata($post) ?&gt; &lt;?php if (!$done_image &amp;&am...
Before you do your output, do something like this: <code> $no_thumbnails = true; foreach( $shows_sales as $p ) { if( has_post_thumbnail( $p-&gt;ID ) ) $no_thumbnails = false; } </code> Then in your loop you can do something like this: <code> &lt;?php if( $no_thumbnails === true ) : ?&gt; &lt;!-- Your output here --&gt;...
How to check all items in a loop have post thumbnail?
wordpress
Situation: my client has this simple gallery built with WP_Query showing the latest media added to the site: <code> $cola = new WP_Query( array( 'post_type' =&gt; 'attachment', 'post_status' =&gt; 'inherit', 'posts_per_page' =&gt; 15, 'post_mime_type' =&gt; 'image/jpeg', 'orderby' =&gt; 'date' )); </code> that's workin...
A similar approach to your <code> post_parent </code> idea is to add a filter to <code> posts_where </code> : <code> function bbg_filter_out_non_attachments( $sql ) { global $wpdb; // Maybe do some conditional logic to decide whether to filter this query, then... return $sql . " AND $wpdb-&gt;posts.post_parent != 0 "; ...
How to fetch only media that was already attached to a post/page?
wordpress
I am trying to add some js to the head using <code> add_action('wp_head', 'js_func'); </code> which works when posted just after the function, however I do not want it posted on every page, just the page that it's relevant to and I am trying to do it like so <code> function things_to_do_on_this_page() { add_action('wp_...
If you want to find out whether you're on a specific page, post, in a category archive, etc., then core has to offer Conditional Tags for this. If you want to hook a js-script definition, then a better way to do this is the following: <code> // Assuming that you drop your js code into a separate file instead of just be...
add_action in a function, is it possible?
wordpress
I've got the famous white screen, but only on my home page. Deeper pages load just fine. I moved my <code> themes </code> directory to <code> themes-old </code> and made a new <code> themes </code> directory that only has twentyten in it. I changed my theme to twenty ten. I don't have any plugins enabled, but I moved m...
To make sure that the <code> index.php </code> will be loaded first add the following line to your <code> .htaccess </code> : <code> DirectoryIndex index.php index.html </code> This tells Apache to ignore an <code> index.html </code> if an <code> index.php </code> exists.
White screen on front page only
wordpress
I'm using WP 3.3.1 I am trying to add BCC onto the headers of an email I'm sending out, but the BCC is not being added. <code> public $from = "sender@example.com"; public $replyTo = "sender@example.com"; public $bcc = "bccaddress@example.com"; $headers['From'] = "From: ".$this-&gt;from; $headers['Reply-To'] = "Reply-To...
You could try to debug the output like this: <code> function test_phpmailer_init( $phpmailer ) { echo '&lt;pre&gt;'; var_dump( $phpmailer ); echo '&lt;/pre&gt;'; return $phpmailer; } add_action( 'phpmailer_init', 'test_phpmailer_init' ); </code> The code in your question is correct, the problem is with your local SMTP ...
wp_mail and BCC headers
wordpress
I'm hosting a local version of my wordpress theme on Ubuntu 11.10. However, LAMP is installed in a directory that requires sudo privileges. When I try to add images or any outside content to my theme, it fails because it cannot create a folder/write to a folder. How do I edit the permissions to allow Wordpress the acce...
I think that setting all to 777 is not the most secure option. Basically, my favourite is to change the wordpress to the webserver's owner. Being: <code> sudo chown -R www-data:www-data /var/www/ </code> So that the webserver is responsible for handling changes. Also, you can change the rights to 755 for the whole /var...
Editing Wordpress Permissions in LAMP - Ubuntu 11.10
wordpress
Below is a simple shortcode I have so that in an article, I can simply link keywords to tag taxonomy pages in my site. So if I were to wrap the term <code> Web Service </code> like this <code> [taglink]Web Service[/taglink] </code> then the function below would replace the space with a <code> - </code> to make <code> W...
If you want to modify content when the user saves a post, you'll want to hook in a function using the save_post hook . Within that function, you can process registered shortcodes using get_shortcode_regex which will give you the shortcodes and attributes used in that post. (However, if you want to process the content w...
How to process shortcode on post save and update only
wordpress
I get an email notifying me of every new user registration on my site and now that it gets hundreds or thousands of new users a day, it's getting a little out of hand. It seems like it'd be a Wordpress setting to disable it, but I can't seem to find anything. Do I really need a plugin to do this?
One plugin, among several: http://wordpress.org/extend/plugins/disable-new-user-email-notifications/ You can grab the function out of it and use it directy in functions.php
Disable new user notification to admin email
wordpress
i want some how to mark the post that has been featured (was a sticky post) in the category template. in wordpress logic it should be something like - <code> was_sticky(); </code> anybody?
Check if »sticky« There's the <code> is_sticky() </code> - Conditional Tag , which you can read about in core here . How-to mark as »sticky« This works for posts, that have the "stick to the front page" check box checked: How »sticky« works internally So basically the function checks if the post-ID is inside <code> get...
marking a post that was sticky on category template
wordpress
I need to insert a rating straight away after having programmatically created a post in WordPress and added a comment. What is the (GDSR) function to call to fire the rating once I've got the post id/comment id?
Here it is: <code> gdsrBlgDB::save_vote($post_id, $user_ID, $ip, $ua, $vote, $comment_id); </code> then insert in the theme: <code> wp_gdsr_comment_integrate_standard_result(get_comment_ID()); </code>
Using GD Star Rating outside of the loop?
wordpress
I want to be able to switch back and forth by clicking an anchor tag preferably, between showing a subset of posts and showing all posts, the code I am using is: <code> query_posts($query_string . '&amp;posts_per_page=-1'); </code> or <code> query_posts( array( 'posts_per_page' =&gt; 45, //'paged' =&gt; ( get_query_var...
You could add a url parameter for posts per page. Something like this: <code> $pppage = ( get_query_var( 'posts_per_page' ) == 'all' ) ? -1 : 45; query_posts( array( 'posts_per_page' =&gt; $pppage ) ); </code> then you can set your URL with the parameter <code> posts_per_page=all </code> if you want to show all the pos...
show all in query_posts on category.php?
wordpress
What is the effect or jquery plugin used to create the on hover video effect used on this site? http://www.iwc.com/it/collezione/
Hi It's not Jquery, it's Flash Your question is not Wordpress related
Name of JQuery technique used on this site
wordpress
How do I extract the last published post in Wordpress? I would be grateful if someone can just point out the relevant action hooks that I should check out. I have seen publish_post, edit_post, save_post, get_the_tags, sanitize_** functions in post.php but so far no success. I want to export the entire array of the last...
Thank You! I sorted this out myself thanks... For any one who stumbles upon this, here's the resolution... <code> // Get the last n number of posts. $args = array( 'numberposts' =&gt; 'n' ); // replace n with the number of posts $recent_posts = wp_get_recent_posts( $args ); foreach( $recent_posts as $recent ){ echo '&l...
Extract the last published post in wordpress (3.3)
wordpress
I've set the 'Welcome User Email' under 'New Site Settings' to the following: Dear USERNAME: Welcome to the SITE_NAME portal which provides information on our policies, processes, > procedures, templates and forms. You can also view the SITE_NAME news, calendar and > contacts. Here is your login information: Username:U...
The technique is basically the same as in the case of <code> wpmu_signup_user_notification() </code> . <code> function wpmu_welcome_user_notification($user_id, $password, $meta = '') { global $current_site; $welcome_email = get_site_option( 'welcome_user_email' ); $user = new WP_User($user_id); $welcome_email = apply_f...
Multisite 'Welcome User Email' SITE_NAME returns 'network' name, not the name of the blog
wordpress
I'm looking for a way to balance the content at the homepage of my blog: the blog has a few post types like Poscasts, Videos and Blog and I'd like to have let's say 10 Posts on the homepage, but I'd like to make 5 of them always the lastest Blog. Making 3 separated boxes don't solve my problem because the posts are mix...
If you are still looking for an alternative that may be faster this may help you: <code> &lt;?php function customBlogFeed() { // The Query $the_query = new WP_Query( array ( 'post_type' =&gt; array( 'post', 'page', 'movie', 'book'), 'posts_per_page' =&gt; '6' ) ); //Your post_type array is a list of random post_types. ...
How to get a variable number of posts per post type on the main loop?
wordpress
I have noticed that wordpress loads a bunch of files into the head of a site. This looks really sloppy and discloses vital information about the file structure of a website. Depending how many plugins are installed a site can easily have 10+ <code> &lt;link&gt; </code> and <code> &lt;script&gt; </code> tags. I understa...
First of all, search this site. This questions has been answered many times in the past: stackexchange-url ("stackexchange-url and stackexchange-url ("stackexchange-url Secondly, there is a difference in what WP loads and what a theme and a plugin will load. Look in the theme functions file to see what the theme loads,...
Why does WP load so many files in the head of source code? How do I optimize it?
wordpress
I have some select posts on one database that I need to export and import into a different database. Because both databases are operating independently, there is overlap with post IDs so I can't export the ID from wp_posts. I can successfully export and import the posts, but the post meta is dropped. And, since I'm not...
Instead of exporting raw SQL, instead us eth eWordPress exporter and import them that way. This way any media attachments, taxonomy terms, and post meta are all included, and all URLs are adjusted too
Export posts with postmeta without ID?
wordpress
I created a wordpress plugin and I added shortcode feature to it. but i want to execute only one shortcode and prevent applying of multiple shortcodes if the administrator did so.
Just remove the shortcode during the first call. <code> add_shortcode( 'foo', 'foo_shortcode_handler' ); function foo_shortcode_handler() { remove_shortcode( 'foo' ); return 'bar'; } </code>
wordpress prevent multiple shortcodes
wordpress
I'm currently researching into using WordPress and so, apologies in advance if this seems like a very basic question. Our main requirement is to have a single blog, but allow multiple users / authors (essentially the entire organization which could be up to 100 people) to post. Is this possible in WordPress? We would b...
There is no limitation on the amount of users... There are some great plugins that would help you manage permissions and limitation you might want to empose to avoid problems.. Tip: Aritcle writers should a writer user level Email Users Plugin - This would help you send email to all users in one click. WyPiekacz - A ve...
Multiple Authors on a Single Blog
wordpress
does WP offer any functions which can be used to set the page title and/or keywords from the PHP/Controller level? I'm basically looking for something like the wp_enqueue_style() function, which results in changes to the HTML page header but for the title and keywords fields. I have some PHP code which dynamically retr...
You can use the <code> wp_title </code> filter to modify the HTML document title, and you can use the <code> wp_head </code> action to hook in a custom HTML meta link. e.g.: <code> &lt;?php function wpse46249_filter_wp_title( $title ) { // $title contains the default document title // output by WordPress. Modify it her...
Setting page title and keywords from PHP code
wordpress
Our users have been complaining about activation emails taking a while to be received. After digging around, we discovered that about 50% of users get the emails instantly and the other 50% take between 5 mins and 2 hours, which is unacceptable. We determined that Wordpress was sending emails at a rate of ~20+ emails/s...
A possible workaround depending on your level of coding knowledge: You could use the Transients API . Simplified: It adds an Option with an expiration time. Then you could hook into the <code> phpmailer_init </code> -action and update the transient value with your new email. If the time expired, you could send the prev...
Limit number of emails per second
wordpress
I have 2 custom fields that I would like to do a meta query on for a custom post type: <code> start_date status </code> The outcome that I am looking for is <code> (start_date &gt;= 1332115200 AND status = 1) OR (status = 2) </code> Is this possible to do with WP_Query?
No, <code> meta_query </code> does not support these sorts of complex clauses in a sequence. There are a couple of ways to work around this limitation. One is to filter <code> posts_where_paged </code> and modify the SQL manually. I just spent a couple minutes playing with this option, and it's not very straightforward...
WP_Query multiple use of relation and/or
wordpress
I wanna preview all the fields that the nav menu $item array holds. Is there a function to fetch it from anywhere and place it inside var_dump?
The items are set up in <code> wp_nav_menu() </code> . There is a useful filter you can use: <code> 'wp_nav_menu_objects' </code> . It offers the items as <code> $sorted_menu_items </code> and the arguments of the <code> wp_nav_menu() </code> call as <code> $args </code> . From <code> wp-includes/nav-menu-template.php:...
How to var_dump nav menu items from anywhere?
wordpress
I have a user using my plugin with the following wp setup <code> WordPress Address (URL) http://server1.theirhost.com/~acct/somewebsite.com/wordpress Site Address (URL) http://www.somewebsite.com </code> I am using admin_url( 'admin-ajax.php' ) to pull the ajax url, which returns <code> http://server1.theirhost.com/~ac...
Depending on how you're mapping <code> somewebsite.com </code> , you can probably just define <code> ajaxurl </code> differently: <code> var ajaxurl = 'http://www.somewebsite.com/admin-ajax.php'; </code> If you need something more generalizable, you could filter <code> admin_url </code> , sniff out whether it's asking ...
Ajax requests with different WordPress Address and Site Address setup
wordpress
I'm using a custom post type and showing 20 of them per page on the homepage. I'm using QP_Query. One custom field for the custom post type (called mixtapes) is a checkbox called "unreleased" (set to true/false), and its basically a post that i dont want to include in the loop. So far I put a conditional if inside the ...
Rather than querying all posts and then only displaying those that match the criteria, query for posts that match the criteria. <code> WP_Query </code> allows you to do just that with its meta-key/meta-value attributes. For instance, to get posts where the custom field <code> unreleased </code> is to 'false', somewhere...
how do i remove posts from a WP_Query so the pagination is right?
wordpress
is it possible to regenerate the slugs programmatically after changing the titles of the post? The girl that updated the title of more than 200 posts just "forgot" to update the slug too, so i was wondering if there was some sort of plugin that regenerates the slugs from the new titles
Yes, it is possible. Sample code, has to be tested and refined: <code> // get all posts $posts = get_posts( array ( 'numberposts' =&gt; -1 ) ); foreach ( $posts as $post ) { // check the slug and run an update if necessary $new_slug = sanitize_title( $post-&gt;post_title ); if ( $post-&gt;post_name != $new_slug ) { wp_...
Regenerate slugs from title of posts
wordpress
In a multisite setup, when users are visiting a blog/site that there are not a member, I would like to display a link to "HOME" that takes them to their "primary" blog. I know how to determine if a user is or is not a member of a site with the is_current_blog_user() function. The part I am having a problem with is corr...
Indeed, <code> get_active_blog_for_user </code> should work. <code> $blog = get_active_blog_for_user( get_current_user_id() ); $blog_url = $blog-&gt;domain... /* or $blog-&gt;path, together with $blog-&gt;siteurl */ </code> Alternatively: <code> $blog_id = get_active_blog_for_user( get_current_user_id() )-&gt;blog_id; ...
How can I get multisite primary blog (url or path) for current user?
wordpress
I need php code to create a static front page for my blog.how do it by php in wordpress.anybody can help me.
From @Ray Mitchel's answer the tutorial shows you how to set a specific page in your blog to be the front page. Assuming you're using the TwentyEleven theme, you need to learn about page templates. The WordPress site has an article: http://codex.wordpress.org/Pages#Page_Templates . So you can create a page template by ...
how to create a static front page for my blog in wordpress
wordpress
I have a custom WP_Query loop that I use for the main archive page. How can I filter the custom query to diplay posts from within 2 days +/- of one year ago from todays date? My current query: <code> $posts_args = array( 'post_type' =&gt; 'album', 'post_status' =&gt; 'published', 'paged' =&gt; $paged, 'order' =&gt; str...
Filters allow you to change data as it is being used by the wordpress core. This is a huge part of what gives wordpress so much flexibility. <code> add_filter() </code> has 2 main parameters, the filter's hook and the callback function. When the filter is executed, all the callbacks associated with that filter will be ...
How to display a posts 1 year ago with custom WP_Query loop?
wordpress
Is there a way to display all the search results on the search.php? Actually is displaying only 10 results (as set in wordpress settings > general).
The quick and dirty way to do it would be to use query_posts again, doubling the number of database calls. <code> &lt;?php if (have_posts()) : ?&gt; &lt;?php query_posts('showposts=999'); ?&gt; </code> Better would be to add this to functions.php, altering the original query before it is executed.: <code> function chan...
Display all search results
wordpress
Here is my comments.php: http://pastebin.com/E5bz4aaW The problem is that the threaded comment (the reply) showing my post date instead if the comment date. I checked in the database and it looks fine there. The date is the same but the time is good(11:13) Example: http://cl.ly/0W2P1b0c2N0W151v1E1d/Screen%20Shot%202012...
Try to use the wp_list_comments function: http://codex.wordpress.org/Function_Reference/wp_list_comments It allows you to control the aspect of every comment, also the replies. Then, you define a callback function, which will be called when Wordpress creates each comment. Your callback needs to start like this: <code> ...
Comment time is same as the post time
wordpress
I make basic formatting to the text in visual editor. When saving, everything got lost, formatting, spaces, paragraph.... everything got inline... I will go crazy !... why it's doing that ?.. i can make testing as request to gt out of this problem.. thanks in advance the DB and WP got reinstalled, and is hosted on host...
After a lot of research (2 day) i finally found a plaster... it's not a fix, but it make the editor work for most of the work. Here is the code to add to function.php of the theme: <code> function cbnet_tinymce_config( $init ) { $init['remove_linebreaks'] = false; $init['convert_newlines_to_brs'] = true; $init['remove_...
Lost formatting after saving
wordpress
I have 3 folders with images that I want to add to my media library. I do not want to have them uploaded under the default path (i.e. uploads/year/month). I can upload them anywhere in the theme folder. Is there any plugin/method to do that?
You can use the Add From Server plugin.
Is there any way to add images to the Media Library through a path on the server?
wordpress
I am trying to create an upload area (frontend) for word press users on a site. I've got a lot of types opened up through some function calls, but unable to correctly get PSD support. I'm seeing a lot of different types, and to my knowledge have tried all. I'm not sure if my hosting environment makes any difference. Am...
This is what I use to allow PSD upload: <code> add_filter('upload_mimes', 'custom_upload_mimes'); function custom_upload_mimes ( $existing_mimes = array() ) { $existing_mimes['psd'] = 'image/vnd.adobe.photoshop'; return $existing_mimes; } </code>
What is the correct MIME type for PSD (Photoshop)
wordpress
I'm operating on two WordPress sites and I need to export posts only with a specific custom field from one site and import into the other. I can't do a generic dump of the database because some data would be overridden. My SQL query: SELECT * FROM wp_posts INNER JOIN wp_postmeta ON wp_postmeta.post_ID = wp_posts.ID WHE...
Change your query to: <code> SELECT wp_posts.* FROM wp_posts INNER JOIN wp_postmeta ON wp_postmeta.post_ID = wp_posts.ID WHERE ( wp_postmeta.meta_key = 'Color' AND wp_postmeta.meta_value IS NOT NULL ); </code> That way it only gets the data in wp_posts, but still filters based on your criteria.
Export SQL query based on custom field?
wordpress
how does <code> esc_html__ </code> (the 2nd one) protect the <code> $message </code> variable from being hacked ? what's the point to use this protection here (the second one with a plain text)? <code> &lt;?php function unknown(){ /* If the user input any text, escape it. */ if ( !empty ( $_POST['unknown'] ) ) $message...
It really doesn't do much in that scenario. If you're going to leave that message as a string constant instead of something that is system or user generated, you're fine using one of the other translation functions: <code> __() </code> or <code> _x() </code> . <code> esc_html__() </code> is a little overkill for that p...
esc_html__ security : what for in this example?
wordpress
I have a problem with permalinks for custom taxonomies generated with Types http://wordpress.org/extend/plugins/types/ , a plugin for creating taxonomies, custom posts and custom fields. The problem is that once i set up my taxonomy i'm not able to configure the permalinks. The options for my taxonomies are: Plural nam...
Looks like it's not something can be done without digging into the code. However i found a plugin the fits my needs pretty well: http://wordpress.org/extend/plugins/taxonomic-seo-permalinks/ with this you can just set /%your-taxonomy%/%postname%/ in the permalinks settings page and your done!
Plugin generated taxonomies' permalinks with custom placeholders
wordpress
I've got a page called Blog. In the <code> Settings -&gt; Reading </code> I've set my <code> Blog page </code> as <code> Posts page </code> . In the menu when I click on the <code> Blog </code> link the posts are loaded correctly and pagination works, so far so good. All the info is coming from the <code> home.php </co...
This is the default Wordpress behaviour for pagination when using a custom query (where you feed in the paged value yourself) or in the index.php as it doesn't realize there isn't content to display on the XXXth page until it has already loaded the template, and then tries to run the WP_Query. You can try adding logic ...
Non existing blog pages are not redirected to 404
wordpress
I want to know if there is a way to use Wordpress Adminitration Tooltips (de gray and blue ones) that are shown one you update your worpdress (3.x). Showing the new features. Thanks!
here is the simplest implementation I know of since there is no real API: <code> //add the needed scripts and styles add_action('admin_enqueue_scripts', 'wpse_46028_enqueue_admin_scripts'); function wpse_46028_enqueue_admin_scripts() { wp_enqueue_style('wp-pointer'); wp_enqueue_script('wp-pointer'); //hook the pointer ...
Wordpress Admin Tooltip hooks
wordpress