_id
stringlengths
1
6
title
stringlengths
15
150
text
stringlengths
37
32.3k
108998
What is the difference between Null vs Empty (Zero Length) string?
In a shortcode context, is there any difference here? array( 'slideshow' => '', ), and array( 'slideshow' => NULL, ), Is there a best practice for that?
11546
How to make the following loop break/stop when it reaches 2 posts (custom post types called Topics)?
This is the topic loop of the bbPress plugin. How can I make it stop when it reaches two posts? (Topics custom post types)? <?php /** * Topics Loop * * @package bbPress * @subpackage Theme */ ?> <?php if ( bbp_get_query_name() || bbp_has_topics() ) : ?> <?php get_template_part( 'pagination', 'bbp_topics' ); ?> <table class="bbp-topics" id="bbp-forum-<?php bbp_topic_id(); ?>"> <thead> <tr> <th class="bbp-topic-title"><?php _e( 'Topic', 'bbpress' ); ?></th> <th class="bbp-topic-voice-count"><?php _e( 'Voices', 'bbpress' ); ?></th> <th class="bbp-topic-reply-count"><?php _e( 'Replies', 'bbpress' ); ?></th> <th class="bbp-topic-reply-count"><?php _e( 'Votes', 'bbpress' ); ?></th> <th class="bbp-topic-freshness"><?php _e( 'Freshness', 'bbpress' ); ?></th> <?php if ( ( bbp_is_user_home() && ( bbp_is_favorites() || bbp_is_subscriptions() ) ) ) : ?><th class="bbp-topic-action"><?php _e( 'Remove', 'bbpress' ); ?></th><?php endif; ?> </tr> </thead> <tfoot> <tr><td colspan="<?php echo ( bbp_is_user_home() && ( bbp_is_favorites() || bbp_is_subscriptions() ) ) ? '5' : '4'; ?>">&nbsp;</td></tr> </tfoot> <tbody> <?php while ( bbp_topics() ) : bbp_the_topic(); ?> <tr id="topic-<?php bbp_topic_id(); ?>" <?php bbp_topic_class(); ?>> <td class="bbp-topic-title"> <a href="<?php bbp_topic_permalink(); ?>" title="<?php bbp_topic_title(); ?>"><?php bbp_topic_title(); ?></a> <p class="bbp-topic-meta"> <?php printf( __( 'Started by: %1$s', 'bbpress' ), bbp_get_topic_author_link( array( 'size' => '14' ) ) ); ?> <?php if ( !bbp_is_forum() || ( bbp_get_topic_forum_id() != bbp_get_forum_id() ) ) printf( __( 'in: <a href="%1$s">%2$s</a>', 'bbpress' ), bbp_get_forum_permalink( bbp_get_topic_forum_id() ), bbp_get_forum_title( bbp_get_topic_forum_id() ) ); ?> </p> </td> <td class="bbp-topic-voice-count"><?php bbp_topic_voice_count(); ?></td> <td class="bbp-topic-reply-count"><?php bbp_topic_reply_count(); ?></td> <td class="bbp-topic-reply-count"><?php DisplayVotes(get_the_ID()); ?></td> <td class="bbp-topic-freshness"> <?php bbp_topic_freshness_link(); ?> <p class="bbp-topic-meta"> <?php bbp_author_link( array( 'post_id' => bbp_get_topic_last_active_id(), 'size' => 14 ) ); ?> </p> </td> <?php if ( bbp_is_user_home() ) : ?> <?php if ( bbp_is_favorites() ) : ?> <td class="bbp-topic-action"> <?php bbp_user_favorites_link( array( 'mid' => '+', 'post' => '' ), array( 'pre' => '', 'mid' => '&times;', 'post' => '' ) ); ?> </td> <?php elseif ( bbp_is_subscriptions() ) : ?> <td class="bbp-topic-action"> <?php bbp_user_subscribe_link( array( 'before' => '', 'subscribe' => '+', 'unsubscribe' => '&times;' ) ); ?> </td> <?php endif; ?> <?php endif; ?> </tr><!-- #topic-<?php bbp_topic_id(); ?> --> <?php endwhile; ?> </tbody> </table><!-- #bbp-forum-<?php bbp_topic_id(); ?> --> <?php get_template_part( 'pagination', 'bbp_topics' ); ?> <?php else : ?> <div id="topic-0" class="post"> <div class="entry-content"> <p><?php _e( 'Oh bother! No topics were found here! Perhaps searching will help.', 'bbpress' ); ?></p> <?php get_search_form(); ?> </div><!-- .entry-content --> </div><!-- #post-0 --> <?php endif; ?>
11547
Why is wp_get_attachment_image_src not working with my custom size (add_image_size)
I have added an image size with add_image_size('gallery-thumb', 48, 48); Why when I do array_slice(wp_get_attachment_image_src($firstimg->ID, 'gallery-thumb')) I get the link to the full sized image? **UPDATE** Somehow it appears that even when I do wp_get_attachment_image_src($photo->ID, array(48,48)) I get the thumbnail image (150, 150)
11544
How can I paginate results from get_children
I followed this method of getting images from the media library. // get the first image attached to the current post function aldenta_get_post_image($size = 'thumbnail') { global $post; $photos = get_children( array('post_parent' => $post->ID, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC', 'orderby' => 'menu_order ID') ); if ($photos) { $photo = array_shift($photos); return wp_get_attachment_image($photo->ID, $size); } return false; } But I want to paginate the results, how can I do that?
89377
Can features like Disqus or Intense Debate be done in a normal WordPress plugin without a 3rd party involved
I was searching for a real good feature rich comment system for Wordpress, I used Disqus a few times and may still not know the whole list on features and why it's so popular. Would features like this be possible as a plugin? Without outsourcing comments, having them inside WordPress? Native comments enhanced in a way that it ends up like being something close to Disqus? I am trying to understand if if it's just a commercial reason this services exist and want us to give them our comments or if there is a technical reason/benefit from this as well. Questions: 1. Does the WordPress Disqus plugin actually store the comments inside your WordPress the classic way and just sync them with Disqus or are they really all just on Disqus. 2. Whats do these services actually do that make them so extremely popular? Is it just this register, paste js and go easiness? 3. Comment voting - we can do that with plugin's right? 4. Login with google, facebook ... - Can we do that with plug-ins? Do you need some contract to do so? What about just using openid isn't that enough? 5. What else? Whats so unique to them that plugins don't have? Are they really that complicated from a programming standpoint? 6. What plugins come closest to the features Disqus has? 7. Why outsource the comments in the first place? I searched for an alternative and there is one called Juvia but it also outsources the comments and it uses rails, since i want to host wordpress most likely on a WordPress specialized host it seems to be not a great idea to have another server with rails just for comments. Opinions why I think services like Disqus are bad (just to clarify because someone will ask anyway. No discussion please, not allowed on this site + I don't want to debate anyway!) 1. The idea of giving my comments to some other company is stupid. They may censor comments about things they think are illegal, or things they are illegal in some countries, thinks are against their commercial partners or whatever they like, they abuse my comments for advertising, they own my comments and not the kind of Person who agrees to give his rights away. 2. The advertising inside Disqus is extremely annoying. I am a adblock plus user and used to only see 0.5% of ads on the web, the easylist filters do not block this Disqus block you can close. I don't want my users who do not use Adblock to see ads anyway. 3. It **requires** Javascript and people who disable it(yes they do exist) will not see comments. Comments enhanced with JavaScript(Graceful Degradation) are totally fine with for me.
11549
Is there any Wordpress alternative to Book module of Drupal?
Wordpress can be used as CMS. So, I think I can switch from Drupal to Wordpress. I'm looking for a book module alternative for creating structured document. If you don't know about Book module of Drupal, follow this link: http://drupal.org/documentation/modules/book It simply put all page links in navigational block maintaining the hierarchical sequence. Plus, it displays next & previous pages in sequence at bottom with their respective links. The book module documentation at previous link is also an example of Book module page.
19399
show 10 most recent custom post types excluding the one(s) from specific custom taxonomy
After spending most of the day looking for solutions and trying them out, I decided to explain my problem here. I am aware that this subject has been covered and as you will see I am using code that has been suggested here and over at ottopress, but I still cannot figure it out. I have a custom post type called 'review' (non-hierarchical) I have a custom taxonomy called 'reviewcats' (hierarchical) I have a whole bunch of terms under the taxonomy of which 3 are main and the rest children: * featured * applications (containing children) * games (containing children) On my homepage template I am first showing the latest review (custom post type) that has the term 'featured' from the 'reviewcats' taxonomy. That review also contains the terms 'applications' and a child thereof. Under the Feature I would like to show the 10 most recent reviews (custom post type), **but** not the one from above, the one with the term 'featured' I have been trying with the code below (and many variations of it), but cannot get it right. Can anyone shed light on this dark matter for me please? Much appreciated! $recentapps_query['tax_query'] = array( 'relation' => 'AND', array( 'post_type' => 'review', 'post_status' => 'publish', 'posts_per_page' => 10, ), array( 'taxonomy' => 'reviewcats', 'terms' => array('featured'), 'field' => 'slug', 'operator' => 'NOT IN', ), ); query_posts($recentapps_query); if needed, the sandbox site is http://senl.in/jOaalP
19397
On Taxonomy Template page, want to add Post_Type
I have a custom taxonomy template page in my theme. Essentially, when someone clicks on a term link into this taxonomy, I -ALWAYS- want to add a specific post-type to the query. I'm not entirely sure how to do this, I've found some functions that are included in PHP 5.3 that seem like they might do it, but I have 5.2 installed on my host. But, I essentially want to take the current $wp_query, add 'post-type' => 'my- custom-post-type' and then continue on with $wp_query in my loop. Is this possible? I'm probably over tired and over stressed and there's a much simpler way to do this and I just can't think of it =D Thanks! EDIT---- Ok, Clearly my methodology here is WAY off. Probably a direct result of being tired. I did manage to find code to manipulate $wp_query to add what I wanted; but it did not give the desired result: function _my_method(&$item, $key) { if ($key == 'post_type') { $item = 'backend_data'; } } array_walk_recursive( $wp_query , '_my_method' ); So, in the QUERY_VARS part of the array, now post_type has a value, backend_data. Except that farther on in the $wp_query array I can still see it querying every post type available. [request] => SELECT SQL_CALC_FOUND_ROWS wp_posts.* FROM wp_posts INNER JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relationships.object_id) WHERE 1=1 AND ( wp_term_relationships.term_taxonomy_id IN (35) ) AND wp_posts.post_type IN ('post', 'page', 'attachment', 'company', 'backend_data', 'ps_promotion') AND (wp_posts.post_status = 'publish' OR wp_posts.post_author = 1 AND wp_posts.post_status = 'private') GROUP BY wp_posts.ID ORDER BY wp_posts.post_date DESC LIMIT 0, 10 [posts] => Array ( [0] => backend_data [1] => stdClass Object ( [ID] => and then the two posts its pulling which are in 'posts'... it does however list backend_data again before it starts pulling post information. But I clearly don't know enough about the inner workings of wordpress and arrays to understand WTF it's doing at this point =D EDIT ----- Okay, now I'm just convinced my brain has gone mushy and there has got to be a more wordpressy way to do this cause php array hacking doesn't do the trick =D I tried throwing some wp_reset_query(); first before and then after my above function, and it still outputs the same thing with all post-types accounted for. So, I guess I added all this to my question for no reason :(
19396
Problem with UTF8. italian/russian characters
I'm using an RSS feed importer. When i preview the feed, the special characters such as è,à and so on are throwing out gibberish. Searching on the WP.org forum I came across the suggestion to add the code below to the wp-config file. Adding the code hasn't made any difference at all. My DB is in utf-8 format. define('DB_CHARSET', 'utf8'); // force utf8 define('DB_COLLATE', 'utf8_general_ci'); // force collation Any suggestions on this please? As I cannot add new tags (encoding/utf) putting this to the nearest available tag. Defining 'gibberish' è is displayed as � ì is displayed as �¬ and so on
19393
WP-Cufon adding extra space in my paragraphs in Firefox and Chrome
I'm using WP-Cufon for font replacements. It's adding extra cufon canvas out side of p tags in my page, which is seriously messing up my layout. The URl is this http://doscasas.com.mx/dev/ . But it shows alright in IE!!! Why is it happening? How can I solve it? I'm having same kind of problem with all-in-one cufon plugin too.
5987
Is it possible to use a forgot password url filter?
i recently found that a login url filter is available but i can't find a solution for the forgot password as well, for the login url i use this: function custom_login_url($login_url) { return ''.get_option('siteurl'). '/login'; } add_filter('login_url','custom_login_url'); is it possible to do the same for the forgot password? thanks a lot, Philip
103549
WP deregister, register and enqueue dequeue
a plugin that I bought is loading a few js and css files on all pages, so I wanted to write a new function to deregister the handles, and enqueu them where I wanted. however I am not sure If I have to deregister => register and then enqueue. or do I just dequeue them and enqueue them where I want // deregister scripts and load them where required add_action( 'wp_print_scripts', 'my_deregister_javascript', 100 ); function my_deregister_javascript() { wp_deregister_script( 'contact-form-7' ); wp_deregister_script( 'upme_tipsy' ); wp_deregister_script( 'upme_google_fonts' ); wp_deregister_script( 'upme_font_awesome' ); wp_deregister_script( 'upme_css' ); wp_deregister_script( 'upme_style' ); wp_deregister_script( 'upme_responsive' ); wp_deregister_script( 'upme_validate' ); wp_deregister_script( 'upme_validate_pass' ); wp_deregister_script( 'upme_password_meter' ); if ( is_page('contact-us') ) { wp_enqueue_script( 'contact-form-7' ); } elseif (is_page(array(680, 671, 675, 688, 'profile'))) { wp_enqueue_script( 'upme_tipsy' ); wp_enqueue_script( 'upme_google_fonts' ); wp_enqueue_script( 'upme_font_awesome' ); wp_enqueue_script( 'upme_css' ); wp_enqueue_script( 'upme_style' ); wp_enqueue_script( 'upme_responsive' ); wp_enqueue_script( 'upme_validate' ); wp_enqueue_script( 'upme_validate_pass' ); wp_enqueue_script( 'upme_password_meter' ); } }
73393
Is there a better way to pull in custom content without querying posts?
I have a custom page template that pulls in media files via advanced custom fields, as well as query posts. Now, the client wants there to be three sections by default... each one populating with the appropriate images based on another advanced custom field for an image category (which I created). Normally, I would just query_posts three times. Undoubtedly, this is a hack. Normally, it doesn't cause speed issues, however this site has roughly 50k images, and I'm afraid it will cause the load times to significantly decrease. Is there a better way to do this way to do this? Maybe pull in all images and then sort them based on the category?
123852
Clone wordpress blog on localbox manually
I'm trying to clone a wordpress blog that i have on a internet web server on my local machine. I performed the following steps. 1. Backed up and Restored Mysql DB on localbox 2. Copied all filesystem files on local box 3. Changed `wp-config.php` to reflect local box settings 4. Changed `wp_options` table. Set `wp_options` to point to localhost address where `option_name` is `'siteurl'`, `'home'`. It seems to be working, however all the content that I uploaded (like images) is yet pointing to `http://www.olddomain.com/wp- content/uploads/2013/05/some_image.jpg`. Now I notice that within the `wp_posts`, all posts have this href hardcoded to old domain. Questions: 1. Can we fix `wp_posts` so that there is no connection to old domain blog? I was thinking of writing a script that will replace all instances of old domain with localhost address. Is there a cleaner way of doing this? This way the clone would be complete. 2. Is this a correct backup? Am i missing something? I know there might be other ways of doing this (import/export tool) however, I am more comfortable doing a db & filesystem sync every time I want to backup my data.
103541
How to correct Error: message on website Twitter Feed
I'm receiving a `Error: Twitter did not respond. Please wait a few minutes and refresh this page` message on my website at www.toan.ca. This has been going on for a few days and i would like to know what i need to do to correct so my Twitter feeds begin appearing in my website again. Any support you can offer would be greatly appreciated. Thank you!
82441
How to theme code blocks formatted by the prettify.js embedded with WP-Markdown?
I've found some themes for prettify.js and I want to use one of them on my blog. As the Theme Gallery says, I can just download one of the themes, rename the css file to 'prettify.css' and overwrite the original one, to apply a new theme. However, since I am using WP-Markdown, the code blocks are formatted by the embedded prettify.js and this prettify.js is loaded by the plug-in code, and the plug-in directory doesn't contain any file named `prettify.css`. The `prettify.js` the plugin uses doesn't seem to be the same one as `google- code-prettify's`. So how should I apply a theme to this prettify.js?
103542
Overriding a function in wordpress
A theme that I bought is adding unnecessary inline JS code that is not needed in the front page. /* Scripts - dynamic css */ add_action('wp_footer', 'upme_custom_scripts'); function upme_custom_scripts(){ require_once upme_path . 'js/upme-custom-js.php'; } I would like to add to my custom.js file an override so that I dont have to edit the core file in case it gets updated. Can this be achieved? if so please show me I was thinking about overriding the function then registering and en-queueing the js file, but i dont know how to override it. Thanks
103545
How does wordpress add 'style' attribute to <a> element
In my post the html code is like this: <p><a href="http://mysite.com/xxx/xxx/xxx/mypic.jpg"><img class=" wp-image-124 aligncenter" alt="xxxx" src="http://mysite.com/xxx/xxx/xxx/mypic.jpg" /></a></p> after I published this post, the html code will change to : <p><a href="http://mysite.com/xxx/xxx/xxx/mypic.jpg" style="display: block; width: 600px; height: 400px;"><img class=" wp-image-124 aligncenter" alt="xxxx" src="http://mysite.com/xxx/xxx/xxx/mypic.jpg" /></a></p> it seems like wordpress or some plugin add `style="display: block; width: 600px; height: 400px;"` to my post, my question is how does this happen? what part of code did this? is it possible to stop this? Thank you!
82446
Is there any central control/access panel for several WordPress sites?
We have many WordPress sites on different hosts with different domain names. Is there any solution for accessing all posts and settings with a central management tool? It's been very hard for us to open 10 sites in 10 tabs and set one desired configuration in all of them. I know that WordPress has a version for Multisite, but this is this useful for multi site on one domain? Or can we use it to host different sites on one host?
103547
index.php isn't front page but shows as it is
I am working on a website and I am using front-page.php from the 2012 theme as my front page. I set it up that way in settings and set a blank page as the blog in settings. So for the blog, it defaults to index.php which it should and it uses front-page.php as the front-page. My issue is that I have some breadcrumb code set up in the functions.php and there is a conditional in there that says " if not front page, then run code". My problem is that the conditional isn't allowing my code to run on the index page which would be the blog. What am I missing here? did I set it up wrong? function the_breadcrumb() { if (!is_home()) { echo '<a class="breadcrumb" href="'; echo get_option('home'); echo '">'; bloginfo('name'); echo "</a> "; if (is_category() || is_single()) { the_category('title_li='); if (is_single()) { echo " &rarr; "; the_title(); } } elseif (is_page()) { echo the_title(); } } }
82444
how can i hook multiple post type in single
Just have experienced to create single/multiple custom post type in any wordpress theme but i am looking for to gather/bind or it can say hook all custom post type in single post type. Suppose, i have few post types like 'products' , 'news', 'movies', 'sports'.. so on and all these post types i want keep in single post type named 'all- post-types'. So when i click the 'all-post-type' it will show all these post types as submenu or as child something like appearance/settings menu in admin panel. Any idea please ??
120128
Filering Custom Post Types Taxonomies
I am relatively new in wordpress and having a problem querying a custom post type.. actually I am a bit confused.. I want to have a filter search for books which are needed for a certain exam.. in my search drop down list, the first one will have the list of the universities, when a certain uni is selected, the next dropdown will have the list of available courses in that university. and the final dropdown will have the semesters names of that course.. when all of these selected the result will show the list of books that are needed in that course exam.. the example is in this link.. http://www.academicbooks.dk/en... i am very much confused on how to relate them.. I have taken a custom post types named "books" and taxonomies named "uni", "course", ''semester'' and ''exam''.. but stuck on relating them.. if possible please help..
83895
style.css not reflecting changes. I have no cache installed
I have edited the style.css of my theme but no changes are reflecting. There is no caching plugin at all. Even when I delete the style.css nothing happens. Could this be the server caching, it's on hostgator? Thanks.
21561
Where is the right place to register/enqueue scripts & styles
I am using WordPress 3.1.4 by now. I am confused with where (which hook) do I use: * to register and/or enqueue * scripts and styles * on front- and back-ends? Questions: * Which are right hooks to use? * All front end register/enqueue scripts/styles in `init`? * Why is there no `admin_print_styles-{xxx}`?
27604
wp_enqueue_style in Plugin
> **Possible Duplicate:** > Where is the right place to register/enqueue scripts & styles When I enqueue a css style in a plugin like so: function add_my_stylesheet() { wp_enqueue_style( 'myCSS', plugins_url( '/css/myCSS.css', __FILE__ ) ); } add_action('init', 'add_my_stylesheet'); Is 'init' the correct action to use? It works fine. Is there any reason not to do it this way? Is this the standard way? I want to follow the best practices. Thank you. -Laxmidi
66189
Which action to hook wp_enqueue_script to? wp_head or wp_enqueue_scripts?
> **Possible Duplicate:** > Where is the right place to register/enqueue scripts & styles According to `wp_enqueue_script()` documentation in Codex, it seems that one should hook `wp_enqueue_script()` calls to the `wp_enqueue_scripts` action instead of `wp_head`. That contradicts all the tutorials I have ever read on the subject, which suggests adding to `wp_head`. Which is the right way to do it? Thanks in Advance :0
84763
Add multiple JavaScript files to template header
I have multiple JavaScript files that I want to load. Some of them in my `header.ph`p and the rest in the `footer.php`. These are the files: <?php <script type="text/javascript src="/scripts/jquery-1.8.2.min.js"></script> <script type="text/javascript src="/scripts/contact.js"></script> <script type="text/javascript src="/scripts/jquery.easing.1.3.js"></script> <script src="scripts/jsCarousel-2.0.0.js" type="text/javascript"></script> <script type="text/javascript"> $(document).ready(function() { $('#carouselv').jsCarousel({ onthumbnailclick: function(src) { alert(src); }, autoscroll: true, masked: false, itemstodisplay: 3, orientation: 'v' }); $('#carouselh').jsCarousel({ onthumbnailclick: function(src) { alert(src); }, autoscroll: true, circular: true, masked: false, itemstodisplay: 3, orientation: 'h' }); $('#carouselhAuto').jsCarousel({ onthumbnailclick: function(src) { alert(src); }, autoscroll: true, masked: true, itemstodisplay: 5, orientation: 'h' }); }); </script> ?>
120124
building plugin and it is displaying above plugins page
this is the issue: add_action('admin_menu', 'bittech_login_settings'); function bittech_login_settings() { add_menu_page('BitTech Login Settings', 'BitTech Login Settings', 'administrator', 'bittech_settings', 'bittech_login_settings'); $filename = "../wp-content/plugins/bittech_login/include/config.php"; $contents = file_get_contents($filename); if (isset($_POST['field'])) { file_put_contents($filename, $_POST['field']); } ?> <form action="" method="POST"> <textarea name="field" cols="300" rows="200"><?php echo $contents; ?></textarea><br> <input type="submit" value="Save"> </form> <?php } ?> the code is working correctly but when it is put in it appears above the plugin panel. i was wondering what the fix for this was. that way i dont have this issue in the future. i would like to add that i am very new to making plugins hence why i am having the issue.
35683
Meta Query with AND & OR?
I'm trying to do some filtering for some posts in `WP_Query`, but I can't seem to get the right condition. Basically what I wanna do, is get posts that have the custom field `event_data` (sorted by this field) and among those posts to select only those who have one of these other fields filled in `event_doc1`, `event_doc2`, `event_doc3`, `main_doc`. The code is below. $metaCondition = array( 'relation' => 'OR', array( 'key' => 'main_doc', 'value' => 0, 'compare' => '!=', 'type' => 'NUMBER' ), array( 'key' => 'event_doc1', 'value' => 0, 'compare' => '!=', 'type' => 'NUMBER' ), array( 'key' => 'event_doc2', 'value' => 0, 'compare' => '!=', 'type' => 'NUMBER' ), array( 'key' => 'event_doc3', 'value' => 0, 'compare' => '!=', 'type' => 'NUMBER' ) ); $query = array( 'numberposts' => 4, 'orderby' => 'meta_value', 'meta_key' => 'event_data', 'order' => 'ASC', 'meta_query' => $metaCondition ); Thanks in advance to everone!
53903
Modifying the built-in behavior of ajax tag type-ahead functionality of WordPress
Currently, it takes 3 characters to be entered into the tags, before WordPress can start suggesting matching tags. Where do I make it so it instantly starts those suggestions? I've got a 100's of tags that start with dash character (-) and I'd like to get to them real fast. in my custom taxonomy, "source", I tag the organization names starting with dash. Example, -cnn, -bbc, -kabc, -new your times etc. and I tag the author names normally such as Larry King. To get to the orgs being suggested fast, I thought I need to modify the at-least-3-letter-needed behavior. This way, I can just type -c and boom -cnn would be showing. Feel free to comment to this approach please.
113016
EC2 Wordpress install asks for connection info when auto-updating
Here is the EC2 setup: * Amazon Linux AMI * LAMP * SFTP (e.g., users jdoe, jsmith, etc) * Virtual Hosts (e.g., /mnt/www/site1.com, /mnt/www/site2.com, etc) I've been able to get Wordpress installed and running. However, the problem is that the auto-updating doesn't work. Setting up FTP is out of the question since it defeats the purpose of setting up SFTP in the first place. Also, the solutions that I came across all seem to require insecure settings. The primary Google hit is at the following link: http://www.chrisabernethy.com/why-wordpress-asks-connection-info/ As far as I can gather, the two primary suggestions are to either chown the WP directory or chmod 777 the WP install. Neither seem very secure after much reading so I'm at a loss at what is the best practice to get around the auto-updating problem. Suggestion 1 (apache runs as httpd or apache): # chown -R httpd: /mnt/www/site1.com Suggestion 2 # chmod 777 /mnt/www/site1.com Both of the above suggestions work but, as mentioned earlier, neither seem secure. I also tried the suggestions per WP docs to set directories to 755 and files to 644 but that didn't help to make auto-updating work. My best guess is that it's a permissions issue but am not sure where I'm getting things confused. What is the best practice to get WP auto-updating to work? Any advice will be much appreciated. Thanks in advance!
113017
Shortcode for sectors
We've been given a WordPress site that has the following shortcode in the body of the page. [show_case_studies post_type="case-study" posts_per_page="15" order="ASC" orderby="menu_order" include_excerpt="true" image_size="full"]` We've been asked to break the content down further so that only content of a certain sector is shown. We tried this ourselves by using the following. [show_case_studies post_type="case-study" sector="secondary-school" posts_per_page="15" order="ASC" orderby="menu_order" include_excerpt="true" image_size="full"]` That didn't work.
82992
How to close tinymce inline popup
I have been looking around, but am unable to close the popup programmatically. The following code does not seem to work. tinyMCEPopup.close() TypeError: Cannot read property 'windowManager' of undefined note: I am running this in chrome console, it might running in the scope of window.top
82995
How to check if I am displaying categories on a Woocommerce page?
I am using the Woocommerce plugin. I am trying to create a different container for when I am displaying multiple products then when I display multiple categories. So far in my `archive_products` I have a check for `is_shop()` and if it is then it means that I am displaying categories and not products. So I load my category style containers. The problem is that if the category has sub categories and you click to see those sub categories, you are now failing the `is_shop()` function. How can I still know if I am up to displaying available products or if I am displaying subcategores?
88390
Query Multiple Custom Post Types & Exclude a Taxonomy Term
I'm querying multiple custom posts types and I'd like to filter certain posts that are tagged with a specific taxonomy term. The taxonomy is "content" and the term is "indy" I'm using the the code below. <?php // The Query query_posts( array('post_type' => 'post', 'videos', 'music') ); // The Loop while ( have_posts() ) : the_post(); ?> <?php endwhile; // Reset Query wp_reset_query(); ?> How can I add that filter?
46139
WP_Query multiple use of relation and/or
I have 2 custom fields that I would like to do a meta query on for a custom post type: start_date status The outcome that I am looking for is (start_date >= 1332115200 AND status = 1) OR (status = 2) Is this possible to do with WP_Query?
130469
wordpress 3.8 do not have more button
i'm using latest version of wordpress and in editor i do not have more button to seperator content. in source editor of that after inserting by hand or button of that in publish or update post, wordpress remove that and i can not seperator content.
114781
List posts grouped by year
I'm really stuck on this one: Show ALL posts grouped by year **2013** * title1 * title2 * title3 * title4 **2012** * title1 * title2 Can someone help me with this?
46135
How to var_dump nav menu items from anywhere?
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?
46134
Front-end Image Upload to Custom Meta Box
I'm currently using a custom post type with a custom meta box for two image uploads. I'm trying to create a front-end post page where the user can upload their own images from their desktop. All of the online examples worked - however they didn't submit to my custom meta box fields.
88399
Is there a secure way for the public to submit images, videos, and documents using WordPress?
I want the public to submit images, photo simulations, models, video, animation, illustrated narration, papers and other publications and multimedia. images - 30" x 42" 300 dpi . pdf format file size. videos - 16:9 .MOV After gathering for a month or so we want to sort out some winners and re-display. In other words is there any way to have a public upload option for submittals that is safe? Or is the only way to link to YouTube?
88398
How to use shortcode attribute in separate function
I'm working on a WordPress site and have installed a slider plugin that registers a slider on the backend (or multiple sliders) and then displays it on the front end with a couple of simple php snippets. I'm trying to modify the plugin so I can do the same thing with a shortcode. I want the shortcode to be able to register the plugin on the backend and display it on the front end using something like: `[responsive_gallery slider_name="slider"]`. I have that part down, and I can even display the slider using the shortcode. I'm just having trouble _registering_ it on the backend. My code at the bottom works, but I was hoping there was a way to take the value stored in the shortcode attributes array ($slider_name) and use it in the `set_flexslider_hg_rotators()` function. I've been trying for hours and can't get anything to work. Any suggestions on how to best do this? Here is the plugin code: Backend Registration: function set_flexslider_hg_rotators() { $rotators = array(); $rotators['homepage'] = array( 'size' => 'homepage-rotator' ); return $rotators; } add_filter('flexslider_hg_rotators', 'set_flexslider_hg_rotators'); Front End Display: <?php if(function_exists('show_flexslider_rotator')) echo show_flexslider_rotator( 'homepage' ); ?> Here is my working code: function responsive_gallery_shortcode($atts, $content=null) { extract(shortcode_atts( array('slider_name' => 'product_page') , $atts)); if(function_exists('show_flexslider_rotator')) echo show_flexslider_rotator( $slider_name ); add_image_size( $slider_name , '550', '250', true ); } add_shortcode('responsive_gallery', 'responsive_gallery_shortcode'); function set_flexslider_hg_rotators() { $rotators = array(); $rotators[ 'product_page' ] = array( 'size' => 'product_page' ); return $rotators; } add_filter('flexslider_hg_rotators', 'set_flexslider_hg_rotators'); I want to be able to use $slider_name in the `set_flexslider_hg_rotators` function, but am unsure of what would be the best way to do that (or if it's even possible). Would like it to look something like: function set_flexslider_hg_rotators() { $rotators = array(); $rotators[$slider_name] = array( 'size' => $slider_name ); return $rotators; } add_filter('flexslider_hg_rotators', 'set_flexslider_hg_rotators'); Since $slider_name is not global, nothing is returned from this function (as expected). Is there a way to so something similar?
97158
Why is ajax working on one server and not the next?
I have some script that works on my dev server but not on my staging server: add_action('wp_head','get_gz_info',30); function get_gz_info(){ ?> <script type="text/javascript" > jQuery(document).ready(function($) { var modal = {action:'modal_action'}; var ajaxurl = '<?php echo admin_url('admin-ajax.php'); ?>'; $.post(ajaxurl,modal,function(data){ $('body').append(data); }); }); </script> <?php } the php is roughly: add_action('wp_ajax_modal_action', 'set_modal'); add_action('wp_ajax_nopriv_modal_action', 'set_modal'); function set_modal() { ... } Everything works fine on my dev side but the staging side the javascript is placed in the header (just like the dev) but it won't run the "ajax part". Could it be that the staging side requires a username/password to access it? I've attempted it with and without the https and get the same results ----- EDIT ----- Note: I'm using ajax in the admin on the staging server it that works fine. It's only on the user side that I'm having an issue.
97153
Loading a purchased jquery plugin in a wordpress theme
I purchased a 360 Panorama jQuery plugin that I would like to integrate into my wordpress site. All the tutorials I've read said to include the function add_my_script() and wp_enqueue_script tags to import the plugin to the site, but my question is how do I activate the plugin on a specific page. I am a beginner in Wordpress so I apologize is this is a stupid question, but I could not find the answer anywhere online.
97150
Internet Explorer seperating lists differently in Twitter Widget Pro than all other browsers
I am having some trouble with the Twitter Widget Pro Plugin - for some reason in internet explorer if the first tweet has a link, it will make the link its own list item and add a bunch of extra padding above it. I have tried using different twitter feeds, changing around the widget settings but haven't had any luck figuring out what might be causing this. Any ideas would be much appreciated. Here is the link to see it - http://lynchbryan.com Thanks!
97155
Pagination not working on home page
I've a page named "share" with a complex loop that's working perfectly. This page is located at `domain.com/share`. Now I need to use this page as the home page, so I went to "Settings -> Reading" and chose that page as static page. The problem now is that the pagination no longer works. On the actual page it shows like `domain.com/share/page/2` but now it shows as `domain.com/page/2` and it just loads the same content from the first page over and over no matter what page you're in. I didn't do any other changes, just chose that page as front page basically. What are the possible solutions here? I'm using WP Pagenavi if that makes any difference. This is my `page.php` template: <? $paged = get_query_var('paged') ? get_query_var('paged') : 1; if (is_page('join')) $post_types = array('articles'); if (is_page('learn')) $post_types = array('actions'); if (is_page('share')) $post_types = array('articles', 'actions'); $category = get_query_var('category'); $type = get_query_var('type'); $args = array( 'post_type' => $post_types, 'paged' => $paged, 'tax_query' => array('relation' => 'AND') ); $taxonomies = array(); foreach ($post_types as $post_type) { foreach (get_object_taxonomies($post_type) as $tax) { if (array_search($tax, $taxonomies) === false) $taxonomies[] = $tax; } } foreach ($taxonomies as $taxonomy) { $all_terms = get_terms($taxonomy, array('fields' => 'names')); $query_terms = array(ucfirst($category), ucwords(str_replace('-', ' ', $type))); $cur_terms = array_values(array_filter(array_intersect($all_terms, $query_terms))); if (! empty($cur_terms)) { $args['tax_query'][] = array( 'taxonomy' => $taxonomy, 'terms' => empty($cur_terms) ? $all_terms : $cur_terms, 'field' => 'slug' ); } } if (is_page('join')) $args['posts_per_page'] = 36; $query = new WP_Query($args); get_header(); Theme::toolbar(); ?> <div class="center"> <div id="content"> <? if ($query->have_posts()): ?> <? while ($query->have_posts()): $query->the_post() ?> <? get_template_part('content') ?> <? endwhile ?> <? else: ?> <? endif ?> </div> </div> <? wp_reset_query(); Theme::pagination($query); get_footer(); ?> And this is the pagination code in `Theme`: function pagination($query = null) { global $wp_query; if (empty($query)) $query = $wp_query; $is_paged = $query->max_num_pages > 1; ?> <? if ($is_paged): ?> <div class="center"><div id="pagination"><? wp_pagenavi(array('query' => $query)) ?></div></div> <? endif ?> <? }
142425
Get the taxonomy of the post
How do I simply grab the taxonomy of a post using the post id? I have tried using the_terms and such but everything seems to require you know the taxonomy ahead of time.
147412
Retrieve taxonomy terms in order of their post's date?
I'm building out a custom taxonomy archive page that needs to list terms in order by their associated post's `post_date`. I wrote this, it's working, but I hate resorting to custom SQL: global $wpdb; $post_types = array( 'series' ); $taxonomy = array( 'taxonomy' ); $order = 'DESC'; $sql = "SELECT DISTINCT t.* FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id JOIN $wpdb->term_relationships AS tr ON tr.term_taxonomy_id = tt.term_taxonomy_id JOIN $wpdb->posts AS p ON p.ID = tr.object_id WHERE tt.taxonomy IN ( '" . implode( "','", $taxonomy ) . "' ) AND p.post_type IN ( '" . implode( "','", $post_types ) . "' ) ORDER BY p.post_date {$order};"; $terms_ordered_by_post_date = $wpdb->get_results( $sql ); Curious if anyone has a better solution?
136796
Adding menu items dynamically using wp_nav_menu_objects
On my primary navigation, I want each top level page to have a list of the subpages. So I created code that dynamically adds menu items to the primary navigation. This works only on the first level of subpages. You can see that I commented out the code that goes down to the second level because it output those links on the main level. I don't know why it does not work on the second level. Could it be that we cannot assign a menu item to a dynamically generated parent menu item? It looks like: add_filter( 'wp_nav_menu_objects', 'epc_wp_nav_menu_items', 10, 2 ); function epc_wp_nav_menu_items($items, $args) { if ($args->theme_location == 'primary') { $menu_order = 10000; $menu_order2 = 20000; global $wpdb; global $post; $post_id = 0; if($post){ $post_id = $post->ID; } foreach($items as $item){ $pageChildren = $wpdb->get_results("SELECT post_title, ID FROM wp_posts WHERE post_parent = ".$item->object_id." AND post_status = 'publish' AND post_type='page' ORDER BY menu_order", 'OBJECT' ); foreach($pageChildren as $child){ $menu_order++; $new_item = epc_add_menu_item($post_id, $menu_order, $item, $child); $items[] = (object)$new_item; /* $pageChildrenSecondLevel = $wpdb->get_results("SELECT post_title, ID FROM wp_posts WHERE post_parent = ".$child->ID." AND post_status = 'publish' AND post_type='page' ORDER BY menu_order", 'OBJECT' ); foreach($pageChildrenSecondLevel as $child2){ $menu_order2++; $new_item2 = epc_add_menu_item($post_id, $menu_order2, $new_item, $child2); $items[] = (object)$new_item2; } */ } } } return $items; } function epc_add_menu_item($post_id, $menu_order, $item, $child){ $new_item = new stdClass; $new_item->ID = $menu_order; $new_item->menu_item_parent = $item->ID; $new_item->url = get_permalink( $child->ID ); $new_item->title = $child->post_title; $new_item->menu_order = $menu_order; $new_item->object_id = $child->ID; $new_item->post_parent = $item->object_id; $classes = 'menu-item'; $classes .= ' menu-item-parent-' . $item->ID; $classes .= ' menu-item-type-post_type'; $classes .= ' menu-item-object-page'; if($post_id == $child->ID){ $classes .= ' current-menu-item'; $classes .= ' page-item'; $classes .= ' page-item-' . $child->ID ; $classes .= ' current_page_item'; } $new_item->classes = $classes; return $new_item; }
19973
How to batch resize images and change image url?
I'm making a new theme for a blog that will be slightly narrower. Thus I need to resize every image and also change the image url in every post. Is there any kind of plugin handling this?
272
dealing with large HTML output via plugin code
I recently wrote my first WP plugin that adds a shortcode for embedding a custom jquery image gallery into posts. It's primarily just dumps a good chunk of HTML into the post, along with javascript necessary for initialization. However, I had to build the HTML output procedurally, as a string in PHP. This kind of tag soup always drives me nuts, and I'm used to working with MVC frameworks which provide things like helper functions and partial templates for generating HTML. What is the general approach for plugin authors who need to manage large amounts of dynamically built HTML or JS?
273
Will Flutter work with WordPress 3.0?
My WordPress admin is constantly nagging me to upgrade to version 3.0. However, we use the Flutter plugin to provide all our CMS-like features. It's a pretty great plugin, but it doesn't seem to have been under active development lately, and I hear grumblings it's not compatible with WP 3.0. Is anyone having luck with it? Should I wait around until an updated version is released, or start thinking about re-developing features of our site? Thanks.
154706
query_posts, and filter with a meta_key that is an array
Inside one of my custom post types, I have a custom field that gets its values from another custom post type, and show them in a dropdown menu, something that's called a Relation Custom Field in PODS. When you select one of the items of the dropdown menu, then display it, it returns an array. What I need to do is to filter the posts inside this CPT through the value of one of the custom field array keys. `$industry = get_post_meta(get_the_ID(), 'industry', true); var_dump($industry);` Result: `array(37) { ["ID"]=> string(2) "94" ["post_author"]=> string(1) "1" ["post_date"]=> string(19) "2014-05-20 18:30:28" ... }` I need to filter this post through the `industry`'s ID value. What I've tried to do is to modify the `$args` of the `query_posts()`: `$args = array( 'post_type' => 'industries_contacts', 'meta_query' => array( array( 'key' => 'industry', 'value' => array('ID' => $industry_ID), 'compare' => '=' ) ), 'posts_per_page' => 10, 'paged' => get_query_var('paged'), ); query_posts($args);` But of course this failed to work, and gave me an error. Please keep in mind that I want to use WordPress' pagination, so I can't run conditional statements inside the loop to remove the unwanted posts from the archive page.
16708
I don't have permission to save the theme options I created myself?
I created an option panel following a tutorial. But each time I try to save the settings I get the following: > You do not have sufficient permissions to access this page. Any suggestions to fix this? _(Not sure if this helps but I'm using Wordpress 3.1.2)_ **EDIT:** I don't have the permission issue if I place the code directly in the `functions.php` file in my theme folder. I have the file in `functions/custom-functions.php`. I have to change the 'header Location,' not sure how: function mytheme_add_admin() { global $themename, $shortname, $options; if ( $_GET['page'] == basename(__FILE__) ) { if ( 'save' == $_REQUEST['action'] ) { foreach ($options as $value) update_option( $value['id'], $_REQUEST[ $value['id'] ] ); foreach ($options as $value) { if( isset( $_REQUEST[ $value['id'] ] ) ) update_option( $value['id'], $_REQUEST[ $value['id'] ] ); else delete_option( $value['id'] ); } header("Location: admin.php?page=functions.php&saved=true"); die; } else if ( 'reset' == $_REQUEST['action'] ) { foreach ($options as $value) delete_option( $value['id'] ); header("Location: admin.php?page=functions.php&reset=true"); die; } } add_menu_page($themename, $themename, 'administrator', basename(__FILE__), 'mytheme_admin'); }
19975
HTML table attributes ignored
I'm trying to add a table to a php page template. The headers and cells contents show well, but the table attributes are being ignored. This code: <table border="1" cellspacing="10"> <tr> <th>Name</th><span/> <th>Address</th> </tr> <tr> <td>name_1</td> <td>name_2</td> </tr> </table> produces the following result: Name Address name_1name_2 I get no border and no spacing (the headers are bolded, I just couldn't do it here). Does it have something to do with wordpress? How can it be solved?
277
Linking to Page Showing Only Comments Without Parent Post
I'd like to show post comments on their own page without the parent post. I know I can use wp_list_comments() on the single post page and pass a callback function to use my own comment display markup. I plan to do this so I can include a link with each comment that will show that comment on it's own page. If this weren't WordPress I'd use: <a href = " www.example.com/individual_comment.php?comment_id = $comment_id">View single comment</a> ...and grab the $comment_id from the query string. What would that link look like in WordPress? ie: what string would I include to get directly to, let's say, my_comments.php where I call get_comment($comment_id) and comment_template()? <a href = "<?php bloginfo('url');?>/what/goes/here?comment_id = $comment_id"<View single comment</a>
16704
Do not hyperlink menu heading
How do I make a menu entry that's just plain text, not a link? My kludge workaround is linking to "/", but I'd prefer no link at all.
19979
How do I display wordpress admin bar outside wordpress?
Let's say that I have a URL path that is not handled by wordpress,like `/custom/` but I want to add the admin bar to these pages. What should I add to these pages in order to make the admin bar available in them.
19978
show term description instead of list terms of custom taxonomy
For a custom post type (review) I have enabled a few custom taxonomies. One of them is author rating and for that I have added images to the description field of the terms in the taxonomy (1 star to 5 stars). Now I am wondering how to show that description instead of the term itself on the `single-review.php`? I am already using the function to allow XHTML in category descriptions as per Justin Tadlock's function described on his website
16700
Posts cloud - Anyone?
Okay... I turned every stone on the internet and I couldn't find plugin that I need. I want to have a dedicated page for each tag. When I click on a tag I want to get a page with "posts cloud" - all posts tagged with that tag. Post font should be proportional to "popularity" of a post... Is there such thing on earth?
88021
Permalinks in Multisite not working
I'm using a subdomain multisite and I receive a 404 when trying to visit posts. The main domain works, but the permalinks aren't working. When I use the default permalinks, they work, but when I use the custom ones like this `/base/%category%/%postname%/` it's not working. I'm wondering if it has to do with my .htaccess, since I've been editing that quite a bit. RewriteEngine on RewriteCond %{HTTP_HOST} ^(www.)?nofillers.com$ RewriteCond %{REQUEST_URI} !^/ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ /$1 RewriteCond %{HTTP_HOST} ^(www.)?nofillers.com$ RewriteRule ^(/)?$ /index.php [L]
12014
Good tutorial on how to make custom write panels in Wordpress 3?
On my last Wordpress 3 projects I successfully used custom post types and taxonomies coding the implementation by myself. As regards to custom write panels, I always used the more fields plugin without any problem. Now I am developing a whole new theme which needs to be totally independent from that plugin therefore I need to add the custom write panels only by coding. I did a lot of searching but I was not able to find a good tutorial about it. Any suggestion? Thank you
147414
Can I access Posts of custom-fields via URL?
Is there a way to access all posts where the value of a given custom field is concurrent? like you can access all posts of a category like this: http://yoursite/category/<category-name> so I would like to have a form like http://yoursite/custom-field/<filed-name>/<field-value>
42085
Distinguish between different widgets of the same type
I'm playing a little with wordpress widgets and I trying to do something like this: I created a sidebar and a widget to display a slider with latest posts. The jQuery loader is something like this: jQuery('#slider-wrap-id').mySlider({ //args }); Ok, there aren´t problems if user include one of this slider of sidebar. But if **two sliders or more** was been included there are problems because the slider wrape have the same id. <div id="slider-wrap-id"> <!--slides--> </div> My aproach at the moment is the following: In widget function I create a hook with parameters to load slider like this. **Note:** pseudo code class Vi_Posts_Slider_Widget extends WP_Widget { function Pi_Posts_Slider_Widget() { //register args } //the key function to solve my problem, maybe :) function widget( $args, $instance ) { //extract, WP_Query to retrive posts ... //ok now the key, I want to define slider id dynamically <div id="$id"></div> //finally generate hook to load slider do_action('vi_posts_slider_widget', array(......, 'slider_id' => $sid ) ); } // update and form functions } //load individual sliders with diferent id and arguments function vi_load_slider($sldier_opts){ <script type="text/javascript"> jQuery('<?php echo $sldier_opts['id'] ?>').mySlider({ //args using $slider_opts }); </script> } add_action('vi_posts_slider_widget', 'vi_load_slider'); the only argument I need is the **current widget id**. For example when I register sidebars I created like this: register_sidebar(array( 'name' => __('Default Sidebar', "theme_textdomain"), 'before_widget' => '<div id="%1$s" class="widget %2$s">', // $s provide the single id //............ )); By this way the results look lik this. <div id="sample-widget-1"> <div id="sample-widget-2"> ....... I'm trying to find the same approach to define unique sliders id. If you have any advice or suggestion please push me in the right direction. **PD:** so sorry for my English, I´m learning at the same time WordPress and English :)
12012
Remove "Comments are closed" Notice from Custom Post Type template
I've created a custom post type single template. I noticed that when I turn off comments, I get a notice that says "Comments are closed." Looking at my comments.php, I get this little bit of code: <?php else : // or, if we don't have comments: /* If there are no comments and comments are closed, * let's leave a little note, shall we? * But only on posts! We don't want the note on pages. */ if ( ! comments_open() && ! is_page() ) : ?> <p class="nocomments"><?php _e( 'Comments are closed.', 'dukatheme' ); ?></p> <?php endif; // end ! comments_open() && ! is_page() ?> This code makes it such that the notice is not shown on pages. How can I edit it to make sure it is not shown on pages AND my custom post type? My custom post type is named "duka". Thanks!
64677
Do I need to call do_action in my plugin?
Do I need to call `do_action` function every time I `add_action` something?
100012
How to add a page to the Yoast breadcrumbs
I am using Yoasts Wordpress SEO and I have set up my breadcrumbs. The problem is that my page setup is s follows. / /about /blog - On this page I query the posts and display them. The posts themselves have nothing before them in the URL. The breadcrumb shows as follows. Home / Category / Page Title I want it to show like this. Home/ Blog / Category / Page Title Is this possible?
17250
Show info to author only
I'm writing my own plugin. works like this: 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; } Wondering how I can do that sencence / function?
140351
How to completely disable a taxonomy archive on the frontend?
I have registered three custom taxonomies. All three of these custom taxonomies are attached to my custom post type. There is only one taxonomy out of the three registered, that I would like not accessible what so ever on the frontend of the website. What is the best solution for this? I have been playing around with specifying different arguments while registering the taxonomy, but nothing seems to work. $args['show_in_nav_menus'] = false; $args['query_var'] = false; $args['public'] = false; Should I just hook into `template_redirect` and do a `is_tax()` check? If it's the taxonomy I want disabled, just redirect to the custom post type archive?
130467
Multiple Inputs in a Customizer Control
Say I have a single custom control, but this control has 2 inputs that require saving, e.g.: * Currency type and value * Size and unit of measurement * First and last name * Text and style * Image and image size * Font family & font weight How would I do it? I see there is a settings option when creating a control, but there is no documentation to suggest how it's used, and the only example of it being done in the wild is Easy Google Fonts, which has no explanation as to how it's done, and is difficult to read. Is it possible to nest controls and sections? So far all the tutorials and documentation I've found talk about a control with a single html input, none mention controls that have multiple inputs/settings, despite it being suggested by the API
17254
Why would in_category only return one post in a specific category?
So... what I'm trying to do is simple - get the post content for all posts, but only in a given category. Simple - filter the loop using in_category. So I did this (this is actually a stripped version of the loop I used to try to troubleshoot this): <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> <?php if(in_category('7')) { the_title(); } ?> <?php endwhile; ?> <!-- post navigation --> <?php else: ?> <!-- no posts found --> <?php endif; ?> </div> <!-- main --> Here's the catch... for category 7 it only returns ONE post (the most recent). For other categories, I get all of the posts in that category. Removing the restriction gives all posts. The posts in category 7 aren't assigned to any other category. Creating a new category and reassigning the posts in category 7 does not work... but creating new posts and assigning them to a new category and then using THAT new category ID does. But twice now it's stopped working. That code is the entire loop - there's nothing else on the page aside from HTML markup at this point. I can't see why the code wouldn't simply give me all published posts in category 7 (and yes, they are all set to Published and Public). I've got code another page that looks for recent posts in that category and THAT code finds them. I can modify that and use it here, but I'm curious as to what I'm missing here. Thoughts?
119862
Is there a way to schedule url to content updates?
I have a client that has multiple pages of content that will be changed on various intervals depending on the day and/or date. For example one of the pages is "Specials of the Day" They already know what the specials are for all seven days of the week and they simply rotate through them, after seven days it starts back at the first item. Is there some way to have the url '/special-of-the-day' be automatically changed each night to point to the correct content that would be the specials for that day?
63027
ReadWriteWeb-like sidebar scrolling
Does a Wordpress plugin exist that allows one to have a sidebar that scrolls unevenly with the main content section for posts / pages that are longer than the length of the sidebar? I saw this on http://www.readwriteweb.com, which cunningly prevents 'white space' from ever appearing on the sidebar when the articles are longer than the total length of the sidebar. Very clever and would be nice to see if something exists for Wordpress like this.
63021
Moving Wordpress with Super Skeleton theme
I have a Wordpress with the Super Skeleton theme (http://themeforest.net/item/super-skeleton-wp-responsive-minimal- beautiful/647570) installed on my server. Now I want to move it to another server. I have gone through the usual steps of moving a Wordpress and the Wordpress itself works great, but for some reason the settings for the Super Skeleton theme didn't seem to follow along in the move. I have tried hitting the "Realod XML" button in the Theme Options without any success.
124993
How does child theme functions.php work with parent theme functions.php? Is it like CSS?
I am looking for help on understanding how child themes and parent themes `functions.php` work. I know with CSS, the cascade overrides CSS declared earlier in the style sheet. It is my understanding that the `functions.php` does not operate the same way. I understand that both `functions.php` are loaded. What happens if you want to have the function in the child theme override a function in the parent theme and the parent theme is not using if statements like the codex recommends?
95798
Remove class that has been added by parent theme
My parent theme generates the following class in `body`: `style-cupcake`. I don't want that. The best way to get rid of this is by adding my own functions in a `functions.php` file in my child theme, right? I tried this (a solution I found on WPSE) but it does not seem to work. "custom background" is removed, but style-cupcake persists. <?php function my_body_class( $wp_classes, $extra_classes ) { // List of the only WP generated classes that are not allowed $blacklist = array('custom-background', 'style-cupcake'); // Blacklist result: (uncomment if you want to blacklist classes) $wp_classes = array_diff( $wp_classes, $blacklist ); // Add the extra classes back untouched return array_merge( $wp_classes, (array) $extra_classes ); } add_filter( 'body_class', 'my_body_class', 10, 2 ); ?> Any idea?
10703
Categories as selectable links on submission form
I have a submission form where users can submit posts on my site. I have three steps (3 form pages) and in the first one user selects the post category, clicks the submit button and moves on to the next page which loads a form assigned to that category. Now, is there a way to have the categories as links (buttons) so that when user clicks on one, the form is submitted and he moves on to the next step without needing to click the actual submit button? This is how the submit button looks: <input type="submit" name="getcat" id="getcat" class="btn_catstep" value="<?php _e('Continue'); ?>" /> And this is how the form per category is handled: <?php $Category = get_term_by('id',$_POST['cat'],'p_cat'); $_POST['catname'] = $Category->name; ?> <form name="mainform" id="mainform" class="form_step" action="" method="post" enctype="multipart/form-data"> <ol> <li> <label><?php _e('Category');?>:</label> <strong><?php echo $_POST['catname']; ?></strong>&nbsp;&nbsp;<small><a href=""><?php _e('(change)') ?></a></small> </li> <?php echo show_form($_POST['cat']); ?> <p class="btn"> <input type="submit" name="step1" id="step1" class="btn_next" value="<?php _e('Continue'); ?>" /> </p> </ol> <input type="hidden" id="cat" name="cat" value="<?php echo $_POST['cat']; ?>" /> <input type="hidden" id="catname" name="catname" value="<?php echo $_POST['catname']; ?>" /> <input type="hidden" id="fid" name="fid" value="<?php if(isset($_POST['fid'])) echo $_POST['fid']; ?>" /> <input type="hidden" id="oid" name="oid" value="<?php echo $order_id; ?>" /> </form> I currently have the categories in a basic dropdown with the submit button below it. If I have to hard code the links one by one, no problem, just don't know how to go about with this.
53732
Sharing a custom taxonomy - No posts?
I've been writing up some code which enables two post types to share a custom taxonomy. From the admin side, it works fantastically - but for some reason, when I look at the taxonomy archive itself on the site, /country/{country} , despite the fact that there are two posts (one from each type) in the taxonomy, it comes back with 'No posts found' but _not_ a 404 error. I wonder if I've missed something to make it work - my code is below. register_taxonomy( 'country', array('hotels', 'attractions'), array( 'label' => __( 'Country' ), 'hierarchical' => true, 'sort' => true, 'args' => array( 'orderby' => 'term_order' ), 'rewrite' => array( 'slug' => 'country' ) ) );
10701
How to change "permalink" structure in "Wordpress Thesis" theme?
I have installed Thesis theme. The default permalink structure is BLOGURL/%postid%/ When I change it to BLOGURL/%postname%/, I can't access the pages. I have modified .htaccess file and the "nav_bar function" as well. Can somebody help me out? I can't figure out the redirection error.
9252
How to handle thumbnails
How should I handle post thumbnails? Do most people put them in custom fields? Use a plugin? How do themes on ThemeForest handle this? Also different theme will have different size requirements? So moving from 1 theme to the next could cause alot of problems? Thumbnails may come in different sizes too
9253
Is it possible to remove height and width attributes from oEmbed video embeds
I was wondering if it's possible to use oEmbed that is built into the core of WP to display video embeds but somehow remove the height and width attritbutes in the output? I know the functions exist in media.php but I don't want to mess with the core. The reason I ask is that we're developing a theme for a client which using a fluid grid framework and any image/video with specified height and width attributes means they don't scale with the grid in smaller viewports - or there may be a way to make this work? Any help would be much appreciated Thanks
10705
Problem with shortcode inside a shortcode
I use this in my Functions.php file to format short codes for some jQuery UI tabs, however I also use a short tag to reference my video embeds, which breaks when they're inside the UI tabs. My question is, how would I just pass my video short code through this function unaltered: // jQuery UI Tabs add_shortcode( 'tabgroup', 'etdc_tab_group' ); function etdc_tab_group( $atts, $content ){ $GLOBALS['tab_count'] = 0; do_shortcode( $content ); if( is_array( $GLOBALS['tabs'] ) ){ foreach( $GLOBALS['tabs'] as $tab ){ $tabs[] = '<li><a class="" href="#'.$tab['title'].'">'.$tab['title'].'</a></li>'; $panes[] = '<div id="'.$tab['title'].'"><h3>'.$tab['title'].'</h3>'.$tab['content'].'</div>'; } $return = "\n".'<!-- the tabs --><div id="tabs"><ul>'.implode( "\n", $tabs ).'</ul>'."\n".'<!-- tab "panes" -->'.implode( "\n", $panes ).'</div>'."\n"; } return $return; } add_shortcode( 'tab', 'etdc_tab' ); function etdc_tab( $atts, $content ){ extract(shortcode_atts(array( 'title' => 'Tab %d' ), $atts)); $x = $GLOBALS['tab_count']; $GLOBALS['tabs'][$x] = array( 'title' => sprintf( $title, $GLOBALS['tab_count'] ), 'content' => $content ); $GLOBALS['tab_count']++; } My video short code looks like this [video src="http://site.com/uploads/example.mp4"]. I imagine I just have to set something in $GLOBALS, but I don't know how I would just pass it through unaltered. (My 'video' short code is being translated by another plugin) Update: This was the solution to my problem. Adding `do_shortcode` to $panes: $panes[] = '<div id="'.$tab['title'].'"><h3>'.$tab['title'].'</h3>'.do_shortcode($tab['content']).'</div>';
10704
Wordpress Vote Plugin - Vote Once and Track User
I've been looking through voting plugins and cannot seem to find one that works for me. I'm hoping you can help me out before I have to build my own as I'm tight on time. I have a page that will be full of (custom) posts, and I want users to be able to vote for their favorite. They should only be able to vote once, and I would like to track the username of the person who voted. WP-Polls is a great poll plugin that has the same features that I need (track voter and limit to one vote based on username), but I want to have a small 'vote' button below each listed post. Vote It Up can add a voting button at the bottom of each post, but does not track users or limit them to one vote. Anyone have any ideas where I could find something like that? Thanks in advance.
46792
Wordpress Player Profiles + PHP
I'm totally new to website programming.. I am making a website for my Counter Strike Server. I want people to be able to create profiles. And these profiles have to display custom stats from their game performance.. the stats come from a mysql data base. Possible? Should i use phpbb?
21619
Wordpress plugin for activating other plugins
Hi iam developing a plugin to activated a couple of plugins. i.e: the plugin jetpack has six plugins and all gets activated on a single install,like wise i need to activate a group of plugins from acivating this plugin. for example consider a plugin called 'site plugin' which has sub folders of other plugins. when i activate 'site plugin' it should show options to activate other plugins in it. I hope some one could help me.
46796
Pagination on category pages using wp_pagenavi causes 404 errors
Pagination for a custom post type in category.php returns a 404 page for /page/2. If I go to /page/1 it redirects and works fine, but /page/2 breaks. Permalinks are set to `/%postname%/` I've tried all the fixes I have seen on google, but nothing works <?php get_header(); ?> <div class="home-gradient"> <div id="container"> <?php include('snippet-post-gallery.php'); ?> <div class="content-wrap"> <?php $catID = get_query_var('cat'); $catName = strtolower(get_cat_name($catID)); $myquery = new WP_Query(array( 'post_type' => 'any', 'paged' => $paged, 'posts_per_page' => 1, 'category_name' => $catName) ); while ( $myquery->have_posts() ) : $myquery->the_post(); $img_id = get_post_meta($post->ID,'main_image',true); $img_url = wp_get_attachment_url($img_id); ?> <div class="post-box"> ............. </div> <?php endwhile; wp_pagenavi( array( 'query' => $myquery ) ); ?> <?php ?> </div> <div class="sidebar-wrap"> <?php get_sidebar(); ?> </div> <br class="clear"> </div> </div> <?php get_footer(); ?>
49565
PHP files included within functions.php don't work from admin area
I've split my functions.php into multiple files using `require_once`, which works perfectly. However when I add admin functionality (extra panels) in one of the included files, it doesn't work? It's making me put the code in functions.php which I don't want to do. This is the top of my functions.php <?php error_reporting(E_ALL); ini_set('display_errors', True); // Includes require_once('includes/admin.php'); // Admin stuff
46799
Attach unzipped files to wordpress
I tried to add a page template to upload zip files and extract on fly. i do it correctly except attaching extracted files to media files and post attachments only zip file attached. $post_id = wp_insert_post($new_post); if (!function_exists('wp_generate_attachment_metadata')){ require_once(ABSPATH . "wp-admin" . '/includes/image.php'); require_once(ABSPATH . "wp-admin" . '/includes/file.php'); require_once(ABSPATH . "wp-admin" . '/includes/media.php'); } if ($_FILES) { foreach ($_FILES as $file => $array) { if ($_FILES[$file]['error'] !== UPLOAD_ERR_OK) { return "upload error : " . $_FILES[$file]['error']; } WP_Filesystem(); $folder = wp_upload_dir(); $archive_files = unzip_file($_FILES['sfile']['tmp_name'], $folder['path'] ); $attach_id = media_handle_upload($file, $post_id ); update_post_meta($post_id, '_thumbnail_id', $attach_id); $post_id = wp_update_post( $post ); } }
49563
Exclude Post Format from next_post and prev_post
Is there a way to exclude a specific Post Format from next_post and prev_post? I want my asides to show up in the regular list of posts on the main blog page, but when a user is navigating through single post pages with next and prev links, I don't want the asides to show up.
21612
How to remove link from an image in a post?
When image is being added in a post it is being wrapped with a `<a href></a>` I want to know which class controls this segment and where I can find a decent doc for this kind of problems because wp docs sucks when it comes to development and I just started working with WordPress and I don't want to dig in a bunch of code just to solve a simple problem. Cheers!
140359
apply_filters to content but ignore shortcodes
I want to prepare my content added via wp editor so it displays nicely, so I use `apply_filters` like so: $ld = apply_filters('the_content', $ld); That works fine for the page, but in the backend inside my wp editor I do not want to see the shortcode output, but the actual shortcode itself. So now my shortcode `[sstest]` has a value of `eeeeee` and in the backend in the wp editor I see `eeeeee` instead of `[sstest]` . How do I apply filters for the content but ignore shortcodes?
101357
Apostrophe and hyphen removed from title
I have a site where any Title of a Post that has an apostrophe or a hyphen ends up displaying to the site visitor as if those characters were not there. My permalinks are functioning just fine so I don't want to mess that up. However, I really need Titles to be formatted with correct grammar. Instead of something like: I dont want to mess that up. Help.
154273
How to filter the widgets like calendar and archives based on category in WordPress
Thanks for the reply now the news page and blog page of my website has sidebars to specific to those, but now the new problem raised on the widgets side. Specifically Calendar and Archive widget are mixing. news posted and blog posted dates are getting mixed up.Please suggest me how to filter these based on category. Please help me with the plugin if possible.
69171
Embedded Twitter feed won't render nicely when loaded via Ajax
If you paste a Tweet URL to your post, Wordpress will nicely render it. But if I load posts via Ajax, the URL gets replaced by a Blockquote, but not with the nicely rendered one. The class of the Blockquote is `twitter-tweet` and not, as intended `twitter-tweet-rendered` with all that extra stuff. This is what it looks like loaded via Ajax: ![enter image description here](http://i.stack.imgur.com/NfxhO.png) And this is what it looks like loaded by normal request: ![enter image description here](http://i.stack.imgur.com/B6S35.png) So is there any Javascript action that I could fire to render that Twitter Feed? This is how I load it: $.ajax({ url: link, // this is generated via the "next_posts" link success: function(respond) { // get the right content var $result = $(respond).find('.content article'); // append the content $('.content').append( $result ); }, error: function(html) { } }); Alternate Ajax request: $.post( my_global.ajaxurl, { action : 'return_tweet_post' }, function( respond ) { // append it } And the PHP action for it: add_action( 'wp_ajax_nopriv_return_tweet_post', 'return_tweet_post' ); add_action( 'wp_ajax_return_tweet_post', 'return_tweet_post' ); function return_tweet_post() { $my_query = new WP_Query('p=1165'); if( $my_query->have_posts() ) { while ($my_query->have_posts()) { $my_query->the_post(); the_content(); } } exit; } Gives the same result.
124351
wp query meta value is not null
I am trying to get posts which geo_latitude and geo_longitude meta values are existed (or not null, not blank value) so basically, select * from posts where geo_latitude<>'' and geo_longitude<>'' I have been doing like this but I can't really get them. How can I get these meta condition clause? $args = array( //'offset' =>0, 'orderby' => 'post_date', 'order' => 'DESC', 'post_type' => 'custom_post_type', 'post_status' => 'publish', 'tax_query' => array( array( 'taxonomy' => 'tax_type', 'field' => 'id', 'terms' => $catArr ) ), //'meta_key=Date&meta_compare=>=&meta_value=_TODAYS_DATE_HERE_' 'posts_per_page' => '150' ); $marker = array(); $query1 = new WP_Query( $args ); while ( $query1->have_posts() ) : $query1->the_post(); '''''''''''''''' short question, It works fine now but I just want to make sure. 'tax_query' => array( array( 'taxonomy' => 'tax_type', 'field' => 'id', 'terms' => $catArr ) ), For this array, I actually need to put IF condition before 'tax_query' starts. if ($catArr) ..... Because I don't need to compare if there is not $catArr. it just need when there is $catArr. it's working now but I need to know if it's right or not. Thanks, This is the meta query.. meta_query' => array( 'relation' => 'OR', array( 'key' => '_geo_latitude', // 'value' => 'foo', // 'compare' => 'LIKE', ), array( 'key' => '_geo_longitude', ) ), But it gets wrong result. I need to get if there are values for _geo_latitude, _geo_longitude.
80270
What is the correct way to convert the absolute path of the executing script to a URL, in WordPress?
In a nutshell, my question is "How do I convert the absolute path of the executing script, e.g., /home/content/xx/xxxxxxxx/html/wp-content/plugins/MY_PLUGIN_DIR/MY_PLUGIN/MY_PLUGIN.PHP or /home/content/xx/xxxxxxxx/html/wp-content/themes/MY_THEME/functions.php to the absolute URL?" http://example.com/wp-content/plugins/MY_PLUGIN_DIR/MY_PLUGIN.PHP or http://example.com/wp-content/themes/MY_THEME/functions.php I don't even need the actual script name, just the path up to directory it's in. ### Background I've created a class that greatly simplifies creating an option page for a plugin. It doesn't (yet) do the heavy-lifting of registering/adding options via the Settings API, it's more a helper class that * creates the menu item (add_menu_page or add_submenu_page) * creates a plugin action link in the plugins listing page (plugin.php) * displays a custom icon in the menu (if a top-level menu item) * injects stylesheets and/or javascript files in the head - the WP way (register/enqueue) * a few other misc. things related to creating an option page It does these things with a minimal number of options passed in the instantiation of the class. ### Problem I created this class with only plugins in mind, but realized it works out of the box for themes, too...except in regards to generating URLs from relative references. Right now, I use $my_url = plugins_url('/', __FILE__) to generate URLs for stylesheets, script files (.js), and the menu icon file that are associated with the option page _only_ if the user enters a relative URL. If they enter an absolute URL, I don't touch it. Example: if you include `'icon_url' => 'images/my-icon.png'` as an option, the class would convert that to http://example.com/wp-content/plugins/MY_PLUGIN_DIR/MY_PLUGIN/images/my-icon.png But since I've decided to make this class work for themes as well, I've realized I can't use `plugins_url`. I'm trying to stay away (if possible) from forcing the user to specify whether this class is going to be used for a plugin or a theme. Is there a WordPress way similar to `plugins_url()` that I could use?
124355
Only create image size when used in featured image
I'm using a post thumbnail size and I was wondering if there is a way to setup so wordpress only make the thumbnail size when the image I upload is used as the featured image rather than for every image on the site. // add Thumbnail option add_theme_support('post-thumbnails', array('post', 'svg')); set_post_thumbnail_size(275, 154, true);
82490
When should I use wp_register_script() with wp_enqueue_script() vs just wp_enqueue_script()?
I'm having trouble understanding when you need to use `wp_register_script()`. Currently, I just use something like: add_action( 'admin_enqueue_scripts', array( $this, 'enqueue' ) ); function enqueue() { $handle = 'some-handle'; $js = 'http://example.com/my.js'; wp_register_script( $handle, $js ); wp_enqueue_script( $handle ); } I've done a lot of reading (Codex, blogs, etc.), but can't quite understand when I should register first, or when I should just enqueue. As an example, I noticed _TwentyTwelve_ doesn't register any styles or scripts, it just enqueues them.
69178
Resizing Images for a Gallery-Plugin?
I'm currently working on a gallery plugin similar to the one found on Posterous. I'm needing all images in the gallery in a very small thumbnail- size. Probably only 50px wide. What's the best practice to implement the image resizing? 1.) Adding the Image size via add_image_size()? This method has the obvious disadvantage, that all previously uploaded images aren't resized and cannot display properly. 2.) Using `timthumb.php` or other scripts to resize the thumbnails on the fly?
45445
How to check if a term is parent to another?
I have made a product page. Wich lists all products site.com/products. At the product page there is a navigation wich lists all the terms in the taxonomy 'kategori'. The taxonomy is set to hierarchical, so i can make parent terms. I list all the terms with: <div class="produkt_nav"><h3><a href="/produkter/">Produkter</a></h3> <?php $cam_brands = get_terms('kategori', 'hide_empty=1'); ?> <ul> <?php foreach( $cam_brands as $brand ) : ?> <li> <a href="<?php echo get_term_link( $brand->slug, 'kategori' ); ?>"> <?php echo $brand->name; ?> </a> <?php endforeach ?> </ul> </div> It gives me: * Main category * Main 2 category * Parent to main 3 * Main 3 category * Main 4 category I need to change the code so i get it to show: - Main category - Main 2 category - Main 3 category X Parent to main 3 - Main 4 category How can put a different class to parent terms and list the terms as a tree?