question
stringlengths
0
34.8k
answer
stringlengths
0
28.3k
title
stringlengths
7
150
forum_tag
stringclasses
12 values
Most of the WordPress PDF plugins out there use services like Joliprint and Print Friendly to convert posts to PDFs. Is there a plugin that does this locally utilizing the power of PHP (and/or WordPress), I mean, without using an external service?
I was half way through writing a long answer explaining why there weren't any ... when I found one. WP Post to PDF is a plugin, updated for WP 3.3.2, that generates PDFs locally and caches them for later.
Is There A WordPress Plugin That Produces PDFs of Posts Locally?
wordpress
I have code that has been working for a long time which when a user clicks a button to order database results by name/value, it gets the results via AJAX from a page that does all the querying. I have recently moved the entire site to a new dedicated server and changed some javascript files around, but for some reason ...
Some things to check. Have permissions changed during your migration? Sometimes those things change unexpectedly. Use Chrome inspector to see if any Javascript is failing to load (look for the red x). Have you updated permalinks? Is your new dedicated environment able to support the requirements of everything you're ru...
WP_Query orderby meta key/value suddely stopped working
wordpress
I have a wordpress website which gets around 20K visits a days and with around 7pages/visit and 62 hits per visit. My server is : 8 processors --> Intel(R) Xeon(R) CPU E5405 @ 2.00GHz 8 GB RAM Now my users are complaining about that the site takes time to load sometimes and craches giving the taking too long to load an...
You shouldn't be blindly changing configs in my.cnf. Use rackerhacker/MySQLTuner-perl · GitHub to test and check your my.cnf configs. It will give suggestions for memory allocations and all other aspects of MySQL tuning. You also should configure httpd.conf for high loads. See Apache Performance Tuning - Apache HTTP Se...
Site not responding error - taking long to load
wordpress
How can I only show items from a certain category (category 51)? Here's my loop below that I need to incorporate the code into. <code> &lt;div class="news-content-inner"&gt; &lt;?php $portfolioloop = new WP_Query( array( 'paged' =&gt; get_query_var('paged'), 'post_type' =&gt; 'news', 'posts_per_page' =&gt; 4 ) ); ?&gt;...
You need to modify your <code> WP_Query </code> loop. Add a <code> tax_query </code> argument to filter the category you want. <code> $portfolioloop = new WP_Query(array( 'paged' =&gt; get_query_var('paged'), 'post_type' =&gt; 'news', 'posts_per_page' =&gt; 4, 'tax_query' =&gt; array( // Note: tax_query expects an arra...
Only show posts from a certain category?
wordpress
I am using wordpress for my blog. My blog contains events details and in every post i want to start with "this information is exclusively provided by...." this statement and end with my "feedburner subscribe us box" So what I am actually looking for is <code> &lt;---My String---&gt; MY Actual Post &lt;---My feedburner ...
Actually you don't need a plugin to do this. Just add a simple function to your functions.php file: <code> function my_content($content) { $content = 'My content before post' . $content . 'My content after post'; return $content; } add_filter('the_content','my_content'); </code> If you don't want additional content to ...
Is there any plugin which can paste a common content to my every post?
wordpress
Is it possible to only show posts that have todays date or in the future? I don't want to show any posts that are in the past. Also, I want the list to show posts that have a date in the future as in the CMS it shows as scheduled. Here's my loop: <code> &lt;div class="news-content" style="background-color:#feefe7!IMPOR...
Can't believe I didn't see this sooner, simply solved it with this in the query: <code> 'post_status' =&gt; 'future' </code> So once published it just disappears from the list.
Only show posts with date of today or in the future (i.e don't show past posts)?
wordpress
I'm trying to create a search feature that will allow users to enter a search term and select a couple of categories. The script searches a single category just fine, but when I add more than one I hit a roadblock. My code is as follows: <code> &lt;form method="get" id="searchform" action="&lt;?php echo home_url(); ?&g...
I found the solution... My functions page now looks like: <code> &lt;?php class dropdown extends Walker_CategoryDropdown { function start_el(&amp;$output, $category, $depth, $args) { $pad = str_repeat('&amp;nbsp;', $depth * 3); $cat_name = apply_filters( 'list_cats', $category-&gt;name, $category ); $output .= "\t&lt;o...
Multiple Category Search
wordpress
I have a multi-author baseball site. I want authors to be able to schedule posts to be published at one of four selected times each day. This is important because some authors write game recaps, and an auto-publish of a game recap once the following game has started is pretty worthless. I am looking for a plugin to man...
My approach is to create an hourly cron event that loops through all the draft status posts and checks for the publish month - date and hour saved in post_meta and publishes if scheduled date is not in the future. A publish date and time select meta box is added to the publishing div that updates via ajax when a time i...
Schedule Posts to Publish from Dates/Times Pre-Set by Admin
wordpress
My blog is displaying the full post of my latest blog post, instead of an introductory paragraph only. How do I make it show an introductory paragraph only, so readers need to click into the full post? Here's the blog: http://richardclunan.com/blog/ (I haven't posted on it in a while and I can't remember how to do this...
You need to use the more tag . The documentation is from WordPress.com, but it works the same on self-hosted installs.
Introductory paragraph only in list of blog posts
wordpress
I have this code for insert a permalink but doesn't work, return exactly code: <code> $text = '&lt;form&gt;&lt;td&gt;Permalink to: &lt;?php the_title();?&gt;&lt;/td&gt;&lt;textarea cols="85" rows="2" readonly="readonly" onclick="select()"/&gt;&lt;?php echo $permalink = get_permalink( $id ); ?&gt;&lt;/textarea&gt;&lt;/f...
A better, cleaner way to do this would be to use proper string return methods and concatenation. I say this, because you're trying to put functions that echo content (i.e. <code> the_title() </code> into a variable - this won't work!!! Instead: <code> $text = '&lt;form&gt;&lt;td&gt;Permalink to: '; $text .= get_the_tit...
Insert PHP code in Text
wordpress
I'd like to add a sign-up box with name and email fields to my site. I'll want to add a title so people know it's for my mailing list, and a note to say that i only send mails out occasionally. What would be an easy and solid way to add this? With a plugin? If a plugin is the way to go, waht would be a good plugin for ...
I'm a big fan of MailChimp for managing and sending email lists. As long as you stay under 2k subscribers and 12k emails / month, their service is free. They have a tool that allows you to create and customize an HTML form you can embed in a widget that automatically adds people to your mail list. http://kb.mailchimp.c...
Mailing list sign up box
wordpress
I have been days over this issue now. Initially it was, how to store a user's follower data in database, for which I got couple of nice recommendations here at WordPress Answers. After, following the recommendations I have added a new table like this: <code> id leader_id follower_id 1 2 4 2 3 10 3 2 10 </code> In the t...
I am answering this question extremely late and my apologies for the same. I had been way too busy with deadlines to attend to this. A big thanks to @m0r7if3r and @kaiser in providing the base solutions that I could extend and implement in my application. This answer provides details on my adaptation of the solutions o...
How to extend WP_Query to include custom table in query?
wordpress
Ok I give up. Been looking at multiple examples including stackexchange-url ("this one"). I get the email no problem but there are no attachments. Am I missing the content/type of file type? All the examples I've seen uses only text/html as the content type. Here's what I have (added upon Stephen's request) <code> if( ...
The <code> $attachment </code> argument for <code> wp_mail </code> takes a file (or array of files) - but the file path has to be fully specified. For example: <code> &lt;?php $attachments = array(WP_CONTENT_DIR . '/uploads/file_to_attach.zip'); $headers = 'From: My Name &lt;myname@mydomain.com&gt;' . "\r\n"; wp_mail('...
Using wp_mail with attachments but no attachments received
wordpress
Is it possible to remove the AUTHOR base? Is it possible change it to postedBy so that the urls is site.com/postedBy/joe And finally, is it possible to remove a custom taxonomy base from the url so that a url like site.com/people/joe can become site.com/joe
Use the plugin Edit Author Slug to change the base. Screenshot from the plugin’s settings page: Your other question is … another, separate question. ;)
Removing the base "Author" or changing it to something else. is it possible?
wordpress
I'm creating a plugin version of the Roots Theme function additions - to make it a bit more portable, but have run into a snag. Part of what Roots does is add <code> htaccess </code> rules based on the current theme information -- like so: <code> // only use clean urls if the theme isn't a child or an MU (Network) inst...
<code> TEMPLATEPATH </code> and <code> STYLESHEETPATH </code> will be deprecated in the near future . It is not safe to rely on these constants. Use <code> get_template_directory() </code> and <code> get_stylesheet_directory() </code> instead. And wait until the <code> init </code> hook (or <code> after_setup_theme </c...
Use theme constants in plugin?
wordpress
I purchased a theme and I'm trying to customize the "blog archive" pages for the Portfolio CPT that's included with the theme. The theme is: http://www.templatemonster.com/wordpress-themes/38602.html I've created some Portfolio categories and linked to them in the menu. Here's an example: http://billy.slushman.com/port...
I was looking for a WordPress that would allow to me to display the category name at the top of the page. That function is single_cat_title() - http://codex.wordpress.org/Function_Reference/single_cat_title .
Category names on CPT archive pages
wordpress
I'm trying to use image upload in my theme's options page and haven't found yet a simple ajax upload script with many tutorials or a good documentation, I just want a simple straightforward script so I just edit the file path and couple other stuff, and of course that works with many uploaders on the page. I tried plup...
I have used the native uploader with great results. Try adding this snippet of JS: <code> jQuery('#upload_image_button').click(function() { formfield = jQuery('#fwpPhoto').attr('name'); tb_show('', 'media-upload.php?type=image&amp;amp;TB_iframe=true'); return false; }); window.send_to_editor = function(html) { imgurl =...
What is the simplest ajax upload plugin or script to be used with wordpress?
wordpress
We have a few "sponsor" images on our site which link to our.. well, sponsors! Source <code> &lt;a href="http://www.amazon-below-water.com/" target="_blank" alt="Amazon Below Water"&gt;&lt;img src="&lt;?php bloginfo('template_url'); ?&gt;/images/BelowWater.png" alt="" /&gt;&lt;/a&gt; &lt;a href="http://www.pieraquatics...
AdRotate allows you to track clicks on as many ads as you want to set up. It also allows advertisers to have a special log in so that they may check their own statistics or even update their own ads if you want to give them that power. It's a pretty robust system with decent support and some cool features planned on th...
Log hits on advertiser images
wordpress
I recently migrated a blog from sub.domain.com to blogs.domain.com/sub/. Because I'm using Facebook comments, all the posts published before April 25 need to reference sub.domain.com/blog-entry-title as the fb:comments href. I know how to display certain posts for my date range with this code: <code> &lt;?php function ...
Sure, you can do something like this in your template code: <code> &lt;?php $migrate_date = mktime(0,0,0,1,1,2012); if ( get_the_date('U') &gt; date('U', $migrate_date) ) { echo "&lt;p&gt;New&lt;/p&gt;\n"; } else { echo "&lt;p&gt;Old&lt;/p&gt;\n"; } ?&gt; </code>
How to display a certain template element only for posts published within certain time range?
wordpress
I want to add files from my site or from external links with files to any of my posts, and be able to add the size of the file and choose which ones it will do "File Force" and which not. I want to have too a counter that it will show how many clicks/downloads the file had. Any link that I add to a post internal or ext...
I have used custom fields in the past to do something kinda like this. You name each custom field the same, and then in the value, give it some separation character. I used ||. Then you can do something like this: <code> $output = array(); foreach($custom as $c) $output[] = explode('||',$c); </code> Then you'll have an...
How can I attach files without using a plugin?
wordpress
I am creating a part of my site where a user can enter a comment (review) and rate my web application. When a user enters a comment and rates my site out of 5, their comment will be available to the entire site (after approval). I am not sure whether to go about this by making a database table for this and manually set...
You can use comments and store individual ratings using <code> add_comment_meta() </code> . You would also probably want to store the rating average using <code> add_post_meta() </code> , since it's rather expensive to calculate it on the fly. Each time a rating is added or removed, you will have to update this average...
Can I use wordpress comments system to build a user review system within my website?
wordpress
Is there a way to list posts in the order in which they were modified? For example; A user posts 5 posts (#1 being the oldest and #5 being the newest), by default they would be listed with #5 being at the top, but say the user edited post #3 at a later date, is it possible to then list post #3 above #5 without manually...
If you use <code> WP_Query </code> you can set the <code> orderby </code> to <code> modified </code> and then the order to <code> DESC </code> and you'll be good to go. If it's not a custom query, you can just use the <code> set() </code> method on the default <code> $wp_query </code> global to do the same. Since <code...
Sort posts by most recently modified
wordpress
A while back I installed a plugin which, upon logout, re-directed users to <code> /forums/ </code> . Unfortunately, I have no idea which plugin that was and whether or not it's still active/installed. What code/db settings can I look for to remove the offending code? Thanks in advance,
I discovered the Hikari Hooks Troubleshooter (http://hikari.ws/hooks-troubleshooter/) this weekend to find what plugins were loading my header with competing open graph metadata. Enable it, and visit the frontend. There will be a modal dialog over your site which should list the hooks into wp_logout. One of these will ...
Logout redirects to /forums/
wordpress
I'm adding a settings section to a theme that will allow the user to enter testimonials which will be randomly displayed on the site. Each testimonial has 2 fields, <code> author </code> and <code> testimonial </code> , I've registered my settings as below: <code> register_setting( 'settings-website', 'option_testimoni...
You'd probably be best to use <code> add_settings_field </code> and <code> add_settings_section </code> ... But in any case, <code> save_testimonials </code> is your validation / save callback function. It is given the data from the form and its job is to check it and then return the validated options. You shouldn't be...
Saving multiple fields as array
wordpress
I created an menu by admin panel > Appearence > Menu. I have just one menu page in menu_lateral_1 . Or the result is <code> &lt;li id="menu-menu_lateral_1" class="menu"&gt;&lt;/li&gt; &lt;li id="menu-item-212" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-212"&gt;&lt;a href="my_website"&gt;m...
Take a look at the Codex documentation . The <code> items_wrap </code> attribute is for wrapping the list elements as a whole - not each individual menu item: Whatever to wrap the items with an ul, and how to wrap them with If you look at this line you'll see that it is using <code> sprintf </code> to replace three pla...
wp_nav_menu li item empty
wordpress
I have tried dbDelta and $wpdb-> query, they does not work. Does anyone has any ideas?
According to this forum entry , truncate does not work. I would guess that since it's such a destructive query, that it's filtered by the class. There is also this Trac Post , which if I am reading it right, disallows DDL statements.
How to use "TRUNCATE TABLE" MySQL statement?
wordpress
I'm trying to create a condition in Wordpress that only calls the <code> wp_head() </code> on all pages except for the "About Us" page and "News Articles" pages. Here's the code: <code> &lt;?php if (!is_page('about-us') || !is_page('news-articles')) {wp_head();}?&gt; </code> It seems to work great when I only use the c...
You should be using the "AND" operator, not "OR" <code> &lt;?php if (!is_page('about-us') &amp;&amp; !is_page('news-articles')) {wp_head();}?&gt; </code> Because you want to display the WP head only if both conditions are true.
PHP if Condition not working
wordpress
We have a custom post type in our plugin and now i must provide the user a meta box where he enters latitude and longitude. I want them to be floats, i have no problems in doing the validation client side, but i don't know how i should handle server side validation in wordpress. I thought that there was some API for do...
Not shure if this isn´t a general php question... Use the <code> WP_Error </code> Class. <code> // http://php.net/manual/de/function.is-float.php // http://php.net/manual/de/function.is-int.php // inside your save_post/update_post hooks callback function, // just type cast to float. You could also do a check if it cont...
How do i validate data entered in a meta box so that only floats can be entered in a field?
wordpress
I'm sorting out a long-neglected wordpress.org blog. It has over 100,000 pieces of trackback spam. How can I remove them all?
To make this more WP-ish: <code> function wpse_delete_trackbacks() { global $wpdb; $wpdb-&gt;query( $wpdb-&gt;prepare( " DELETE FROM %s WHERE `comment_type` = 'trackback' ", "{$wpdb-&gt;prefix}comments" ) ); } </code>
How can I delete all my existing trackbacks?
wordpress
Are there any actions I can hook into for update_post_meta()? I don't see anything obvious in the source. Woocommerce lets you change the featured status of items via ajax from the edit screen. I am using a transient to store the featured items in lieu of querying them every time and I'm deleting that transient on the ...
( See codex ) <code> update_post_meta() </code> calls <code> update_metadata('post', $post_id, $meta_key, $meta_value, $prev_value); </code> This function is here . And there are plenty of hooks/filters: (In example of 'post', <code> $meta_type='post' </code> ) Before metadata is updated: <code> update_{$meta_type}_met...
is there an update_post_meta action
wordpress
How can I use wp_get_object_terms() to get a list of all the terms attached to all posts in the current query? For example, for the current query I want to get an array of the terms from the "Alfa" taxonomy that are contained in all the queried posts. <code> wp_get_object_terms($wp_query, 'alfa'); </code> But that only...
I think you're on the right track because <code> wp_get_object_terms() </code> can take an array of IDs for its first argument, it's just that $wp_query is not the array you want. I can't guarantee that this is more efficient (not my area of expertise), but I believe this [partially-tested] snippet would do what you wa...
wp_get_object_terms() to get a list of all the terms attached to all the posts in the current query
wordpress
Update April 27 10:57 AM -- Fail Log To clarify , I've only customized and adjusted the CSS. The first slide works correctly with linking through, but ONLY on the first cycle / initial page load. Then the next time it slides through, it stops linking. ?? -- Orginal Q: So, I guess out of the box. The Simple Nivo Slider ...
Without seeing how you've customized the plugin, I can only go off the code of the stock plugin. By default, it will either use the permalink or whatever you have set in the post meta for <code> simple_nivo_link </code> . Here's the actual code: <code> # process the results while (have_posts()) { the_post(); if(!has_po...
Adding Permalink to Slides with 'Simple Nivo Slider' plugin?
wordpress
I am working on a Wordpress site that has a custom front-end submission form for adding in a post of content type, 'sketchpad'. The form has a section that allows you to upload multiple images with a description field which is going to be used as an alt tag. What is an easy way for me to upload multiple attachments wit...
I eventually worked this out. After a lot of thinking it dawned on me that attachments are merely posts assigned to the post_type of 'attachment' so then I soon discovered that attachments have a post_content field, as well as a post_title field. For my needs, I only needed the post_title attribute as my descriptions a...
Uploading Multiple Attachments From Front-End With A Description
wordpress
I need to know which action / filters are called when i do a <code> get_option() </code> call, how can i do that?
Go down the rabbit hole... http://core.trac.wordpress.org/browser/tags/3.3.2/wp-includes/functions.php#L306
How do i know which action / filters are called when i call get_option()
wordpress
I have many uses for this but I want to know the most performant way of doing what is going to be an expensive operation. As an example I will use a shop. Given: A product brand taxonomy A product group taxonomy A product post type Archive templates for the above taxonomies What is the most efficient, performant method...
To generalize this is issue of retrieving all terms of taxonomy A that posts with specific term of taxonomy B have. While this is not impossible in several steps and plenty of looping through posts (which will indeed be inefficient), I think it's reasonable to go through SQL for efficiency. My rough take on it would be...
Efficient Taxonomy Intersection
wordpress
This is my code thus far: <code> function register_my_menus() { register_nav_menus( array( 'header-menu' =&gt; __( 'Header Menu' ), 'extra-menu' =&gt; __( 'Extra Menu' ) ) ); } add_action( 'init', 'register_my_menus' ); </code> But this seems to only register 'locations' in which to place custom menus. What I want is f...
Example code taken from new2wp.com located HERE <code> // Function for registering wp_nav_menu() in 3 locations add_action( 'init', 'register_navmenus' ); function register_navmenus() { register_nav_menus( array( 'Top' =&gt; __( 'Top Navigation' ), 'Header' =&gt; __( 'Header Navigation' ), 'Footer' =&gt; __( 'Footer Na...
How do I create predefined menus for my theme?
wordpress
I am using Wordpress 3.3.2. Currently I am working on a website in a dev folder on my domain, dev.domain.com. Upon creating pages and blog posts, it just occurred to me that when I move the WP website from dev.domain.com to domain.com that all the images I have used in all my pages and posts will break. Also some image...
There is a helpful codex article about moving WordPress: http://codex.wordpress.org/Moving_WordPress . Basically, you need to find/replace the DB for instances of your old domain, and swap them with your new domain. One additional trick I've learned when moving WordPress between environments: since WordPress stores the...
Change website URL without breaking links or images? WP 3.3
wordpress
I am working on my first WP site and am having some difficulty. In my theme's index.php page, I see the following code: <code> &lt;?php query_posts(array( 'category__not_in' =&gt; array($headline), 'post__not_in' =&gt; $postnotin, 'paged' =&gt; $paged, 'numberposts' =&gt; 5 )); if ( have_posts() ): $postCount = 0; ?&gt...
here's what I ended up doing: <code> &lt;?php query_posts(array( 'category__not_in' =&gt; array($headline), 'post__not_in' =&gt; $postnotin, 'paged' =&gt; $paged, 'posts_per_page' =&gt; 5 )); if ( have_posts() ): $postCount = 0; ?&gt; &lt;?php while ( have_posts() ) : the_post(); $postCount++; if ($postCount &lt; 6) { ...
How to limit the number of posts on the home page?
wordpress
So I would like to set two separate feature images for each post/page. One would be a rectangle for use in a slider and another would be a square for use on archive pages, search pages, category pages. WordPress can do this, but it either resizes the initial image to the nearest resolution or crops it. I would rather c...
This plugin is what you're searching for...
How to implement two separate featured images for each post/page
wordpress
I have a plugin that I am developing that is using custom post types and taxonomies. My question is this. How can I load the content/theme data from my plugin on to the page when the go to the custom url of the taxonomy? EDIT I am trying to use the plugin's template files and not the themes for my custom taxomony.
First of all - plug-ins are for generating content, themes are for displaying it . So really, a plug-in shouldn't do this. But there are grey areas - for example in an 'events' related plug-in, it would be desirable to display dates, venue etc - things that a WordPress theme wouldn't normally display. I would suggest m...
Custom Taxonomy in plugin and template
wordpress
I have looked but could not find either a plugin or code that allows only certin users to login in to my wordpress site e.g wan, velma, bob and no other. Does anyone know how to do this. Thanks Tim
What you can do is to set your specific list of users to admin, and use Theme my Login to redirect admin users to the page you want to see, and to set all other roles to redirect to an invalid page which they can't have access.
How to allow only certain users to login
wordpress
If I use Lighttpd as webserver, how can I use caching plugin like w3 total cache or wp super cache? Need your help for configuring lighttpd. Thanks.
The following script takes the url that was asked from the client. It checks whether there is a fresh version of a static HTML page on the cache and if yes, it servers that. If the file does not exist at all or the it is expired(I check its modification date) then the request is forwarded to the PHP fcgi so that it can...
Lighttpd, WordPress Caching plugin
wordpress
I am making a custom Wordpress site where School students logged in and add their posts. I am giving them rights to use wp-admin panel with little customization and modification. QUESTION: "How can logged in user be able to see comments of his own post only in edit comment admin panel" please suggest me some solution i...
i had been looking for the code where logged in users will be able to see post of his own only i have managed to make simple function that we can use for the same the function snippet has to be included in functions .php file in the theme folder which you are using <code> function my_plugin_get_comment_list_by_user($cl...
How to display only logged in user's post comments in comments area
wordpress
I'm trying to create a list of links to post that are tagged a specific category. Is this possible? I'm not even sure where to begin. Any help? so, for example I'm trying to show the 1st ten post that are tagged "video". thanks,
You can do this by putting this where you want to display the list : <code> &lt;ul&gt; &lt;?php global $post; $args = array( 'numberposts' =&gt; 10, 'offset'=&gt; 1, 'category' =&gt; 1 ); $myposts = get_posts( $args ); foreach( $myposts as $post ) : setup_postdata($post); ?&gt; &lt;li&gt;&lt;a href="&lt;?php the_permal...
How to create a list of links to post with specific category
wordpress
I am looking for a simple (and secure) way to accept payment for event registration. I am managing a Wordpress website for a organization that hosts events throughout the year. A handful of these events include online registration, which is currently completely outsourced to a third-party site. I would like to allow re...
We us Event Espresso for our event management. It allows for multiple events as well as multiple payment gateways, even a ticket addon so users can print custom tickets to your events. Seems like it would be perfect for what you need. http://eventespresso.com/
Simple Online Payment for Event Registration
wordpress
I am using this code to show custom code on single posts. <code> function post_footer() { if (is_single()) { ?&gt; &lt;div class="custom"&gt; &lt;h1&gt;&lt;a href="&lt;?php the_field('live_demo'); ?&gt;" target="_blank"&gt;Live Demo of &lt;?php the_title(); ?&gt;&lt;h1&gt; &lt;h1&gt;&lt;a href="&lt;?php the_field('down...
If it is a single page: <code> is_single() </code> returns <code> TRUE </code> . If a <code> $post </code> is in a specific category: <code> in_category( $cat ) </code> returns <code> TRUE </code> . It needs <code> $cat </code> as ID, name or (string) slug. Anyway: Searching for a list of conditional tags isn´t that ha...
Conditional tag
wordpress
I am building my first responsive WP site with my own custom WP Theme. The primary templates are part fluid, part fixed. This enabled me to create only 3 "versions", a desktop, tablet and mobile version. All changes happen due to media queries. (Sizes are 768 to 1200 px for desktop, 530 to 767 for tablet, 300 to 529 fo...
Do not use server side browser sniffing. It will fail: The question here is how can you reliably detect mobile browsers in order to redirect them? The fact is: you can’t. Most people attempt to do this with browser sniffing—checking the User Agent string that the browser sends to the server with every request. However,...
Responsive Theme Design: how have slideshow on desktops/tablets and static photo on mobile using same template?
wordpress
I'm developing a theme in a local machine and migrating it to a production server. To keep things in sync, i'm trying to avoid any queries of specific ID's On the homepage, i'm trying to query the top 3 pages (by menu_order) from a parent page (NOT the homepage). It works perfectly with the hardcoded ID, but i'm stumpe...
there are two WordPress functions you could try: http://codex.wordpress.org/Function_Reference/get_page_by_title (as suggested by @t31os in the comments to your quoted link) http://codex.wordpress.org/Function_Reference/get_page_by_path if you have already tried them, please describe how these failed to do what you wan...
Query specific posts from parent by slug rather ID
wordpress
I got posts that have starting date as a custom field value. I'm displaying few of those posts in my sidebar in ascending order so that the post with closest starting date is shown first. This is what I have and it works great: <code> &lt;?php query_posts('&amp;post_type=events&amp;posts_per_page=5&amp;meta_key=start_d...
For this to work reliably, the date format in the database should be <code> yyyy-mm-dd </code> . Comparison type should be <code> DATE </code> or <code> NUMERIC </code> . If you take the date of 25-04-2012 in present format and compare it numerically to the date 26-04-1986, you can see what the issue will be: 25042012 ...
Displaying posts with only upcoming dates according their custom field date value
wordpress
I have created an options page for my plugin using Settings API. Now I want to create another tab where user will create records. He will also like to delete/edit records. There will be 10-20 records only. I want to stick with settings API for these records (Single field in database) but I am at a lose to decide if it ...
You should use Custom Post Types. No extra table, no missuse of Settings API. Use CPTs with Title field, WYSIWYG/textarea (for caption) &amp; a featured image (for the actual slider image). This way later themes can also make use of it. Just name the CPT "slider". stackexchange-url ("Here´s a read why sliders &amp; car...
Wordpress settings API VS Table In Database?
wordpress
If I know the current post id that i have in the variable $pid I use $terms = get_the_terms($pid, 'custom_category'); How do I get just the term id/term_taxonomy_id if I var_dump $terms I see what I want...but I have no idea how the heck to return just the id, not an array, just the id. Bare in mind...I less than 1/2 k...
(Probably better to use <code> get_the_terms </code> ). <code> $terms = wp_get_object_terms( $pid, 'custom_category', array('fields'=&gt;'ids')) </code> Get an array of term ids (will always been array, even if it is an array of one): <code> $ids = wp_list_pluck( $terms, 'term_id' ); </code> If you just want one id... ...
Get Current Custom Taxonomy ID by Post ID
wordpress
Seems like a simple enough requirement, but I'm struggling: I want to add an option field to the "Add New Site" . A simple text option is fine. How do I do this? I need to save this custom blog option when the site is created. I know I can use the 'wpmu_new_blog' hook, which passes the <code> $meta </code> variable wit...
Joining two answers(*), I've done a plugin to add a custom meta option when registering a new site (front and back end) and display its value in a column in the Sites screen. Multisite Categories ... (*) code references 1 - stackexchange-url ("WordPress + Multisite: How to add custom blog options to Add New Site form i...
How to add Custom Blog Options to new blog setup form?
wordpress
The title is the question : How to develop a theme while having another show up I already have a DB and a theme.... i like, when log as admin see another theme... just for the time making it clean and final... and then, remove the old one and have the new one able to be see for everybody... any plugin that do that ? so...
I used this one a while ago and it worked. Hasn't been updated in a while...but should still work. http://wordpress.org/extend/plugins/parallels-themes-switcher
How to develop a theme while having another show up
wordpress
I'm having a heck of a time having trackbacks being disabled period on my self-hosted blog. I've disabled the "Allow link notifications from other blogs (pingbacks and trackbacks)" option, and have all comments going through disqus, yet for some reason I'm getting 20-50 trackbacks a day to the blog directly (not throug...
If you are using a twentyten/eleven theme, they hardcode the pingback meta tag into the <code> head.php </code> file. Remove that line or use your own theme. Also, and maybe it's only in multisite, but the X-Pingback header is sent along with the xmlrpc endpoint url as well. Removed with the following: <code> /** * Rem...
Getting trackback spam, even with trackbacks disabled
wordpress
Let me explain the problem I am dealing with: I have 2 custom taxonomies. One is named "thestate" and the other one is named "thetown". In " thestate " I have listed all the states in the U.S. In " thetown " I have listed the main towns in the U.S. For each taxonomy I have their items displayed in a drop-down Do you un...
Why not make the towns child terms of each state? The taxonomy could be location: See stackexchange-url ("MikeSchinkel's detailed q and a regarding hierarchal taxonomies"). A more elegant solution than refreshing the page upon state selected would be to load the "thetown" child terms using ajax and the <code> get_term_...
Show WordPress Custom Taxonomy Items Based On a Selected Item From Another Custom Taxonomy
wordpress
For some reason I can't get the jquery document ready to fire for my plugin my javascript <code> jquery(document).ready(function($) { alert("hello world"); $("#testdiv").text("hi"); }); </code> the source from my website <code> &lt;link rel='stylesheet' id='admin-bar-css' href='http://example.com/wp-includes/css/admin-...
Try using <code> jQuery </code> instead of <code> jquery </code> . (Note the capital "Q".) Edit: Upon viewing your source, you have an extra <code> }); </code> . Working example
jquery document ready function not being called
wordpress
When you create a custom taxonomy, seemingly the only options are to display it as a tag (non-hierarchical) or category (hierarchical). Is there a way to display them as a dropdown menu? I realise that this an be done using <code> add_meta_box() </code> and actually manually adding it, but I'm looking for a builtin way...
Unfortunately there is no way of doing this with <code> wp_register_taxonomy() </code> . When you register a taxonomy, the default metabox is either checkboxes (hierarchical) or as a cloud (non-hierarchical). The only way round it is to de-register the existing metabox and add a new-one in its place. By carefully mimic...
Display a custom taxonomy as a dropdown on the edit posts page
wordpress
I have a plugin that I'm using to switch themes for a specific user for development. When logged in as that user they see the different style sheet but the themes files, function.php, header.php, etc are the active theme for everyone else. What I am doing wrong? <code> function change_user_theme($template) { global $us...
Take a look at my answer here: stackexchange-url ("Switch Theme Through Options Panel") The code is as follows: <code> add_action( 'setup_theme', 'switch_user_theme' ); function switch_user_theme() { if ( in_array( wp_get_current_user()-&gt;ID, array( 5 ) ) ) { $user_theme = 'fezforprez'; add_filter( 'template', create...
Switching theme only changes style sheet being used
wordpress
This seems like simple thing but I need way to determine whether the current screen is for Add New or Edit ( a sort of wordpress admin conditional tag). Is there a built in function for this already, or ... any idea how to accomplish?
here is a function that i have: <code> /** * is_edit_page * function to check if the current page is a post edit page * * @author Ohad Raz &lt;admin@bainternet.info&gt; * * @param string $new_edit what page to check for accepts new - new post page ,edit - edit post page, null for either * @return boolean */ function is...
How to determine whether we are in add New page/post/CPT or in edit page/post/CPT in wordpress admin?
wordpress
I am confused. Want to save data for my plugin. There are people who use add_options and there are others who use register_settings. My question is What is difference between <code> add_options </code> and <code> register_setting </code> ?
register_setting() uses Settings API, which is just an API for options.php, is easier to use, more secure and preffered way of storing options since WordPress 2.7. If you need to store only a few options or doing simple plugin just for yourself - it's really up to you which one to use :) Here's the Settings API (well) ...
difference between add_options and register_setting
wordpress
a plugin i'm working on has a conflict with w3 total cache. To be more specific, in my code i have <code> static function get_instance() { if( self::$_instance === NULL ) { // get the settings from the database self::$_instance = get_option( 'ai1ec_settings' ); // if there are no settings in the database // save defaul...
okay, here we go. try this: in your functions.php modify the behaviour of ai1ec_options: <code> $ai1ec_options = get_option('ai1ec_options'); delete_option('ai1ec_options'); add_option('ai1ec_options', $ai1ec_options, '', 'no'); // thanks for your suggestion :) </code> be careful though, as you might lose your set opti...
Is it possible to disable caching of an option when using w3 total cache?
wordpress
I am having problems finding an answer to this. I need to have a custom user meta field. I can create them which is fine but I need to create a drop down one. For example I want the user meta to be Unit type and the drop down values to be Residential and Commercial Any help on this would be great. Thanks.
thanks for that. Just one minor tweak, as the first bit of code threw up an error. Below is the working code for the first block of code. <code> //hooks add_action( 'show_user_profile', 'Add_user_fields' ); add_action( 'edit_user_profile', 'Add_user_fields' ); function Add_user_fields( $user ) { ?&gt; &lt;h3&gt;Extra f...
Drop down list in user profile page
wordpress
What are some plugins or alternatives to the PressThis function? I want to use the PressThis bookmarklet to quickly blog about what I see online, but every time I do and include an image, it hotlinks to the image from the site I'm blogging about. That's bad, because I don't want to tax the site I'm writing about. I don...
PressThis bookmarklet does upload images to the wp uploads folder that you add to the article. Basically in the PressThis window go to the 'Add' menu and click on 'Insert an Image' icon. It will populate thumbnails of images found on the web page you are on. Click on the image you want to include in your post and that ...
Is there a PressThis that doesn't hotlink?
wordpress
I really like the way SE uploads an image from a URL (I'm sure many do!). I've been searching, but can't find, is there a plugin or a method similar to this available for WordPress? I know an image can be uploaded and crunched directly from a URL by entering the image URL into the File Name box after you click Upload/I...
WordPress Plugin Directory - Grab &amp; Save This plugin allow you to grab image from remote url and save into your own wordpress media library. By doing so, you never worried if the remote image was removed by its owner. This also save you steps to download the image to local computer and upload again to your own word...
Image Upload from URL
wordpress
I'm not looking to spam anyone, but I am looking for a mass mail plugin so I can select the User Roles (whether core or custom) by check box or comma separated entries of the roles, then type my message and send. The reason: I have a multi-author website with active contributors, authors and editors. I am looking for a...
WordPress Plugin Directory - Email Users A plugin for wordpress which allows you to send an email to the registered blog users. Users can send personal emails to each other. Power users can email groups of users and even notify group of users of posts. I also use the Admin Menu Editor plugin to hide Email Users from lo...
Mass Mail Plugin to Email Specified User Roles
wordpress
I have a lot of images in my computer and I want to upload them to my website. For that I am looking for some automated plugin in which I can copy those images and it would upload them itself. Is there any Wordpress plugin that does it? EDIT To clearify what I want to achieve is, When I drag and drop images to the FTP ...
This plugin does a batch upload and creates a new post/page/cpt from each file Fuxy's WP Images 2 Posts You would only achieve the " Images get uploaded itself from the computer " if you make a custom script (Automator in Macs, don't know in Windows...) that would run in your OS and do that for you... But, I don't have...
Images get uploaded itself from the computer
wordpress
Development on a WordPress installation is under Subversion version control. We're not using externals to link in the plugins - the plugins are getting installed / updated by non-developers in charge of content. This causes issues within the repository, especially for plugins that are already under version control and ...
Real answer, taking all the above into account: Regarding <code> .svn </code> directories: Subversion 1.7 was released a little over a year ago ( http://svn.haxx.se/dev/archive-2011-10/0152.shtml ) and the working copies no longer contain .svn directories in every folder. They contain a single .svn directory in the roo...
How do you allow plugins to be updated using the GUI without breaking your subversion repository?
wordpress
This is all about featuring content in WP. Say, you got 1000's of posts that you accumulated over the years and each has their own original ( and true ) post dates. And now you want to feature them again. Say in your category taxonomy, you have a branch called Featured and underneath are the sub items as follows; <code...
Use Sticky Posts . In the Post editor find the "Publish" section. Next to "Visibility" click on edit and then check the "Stick this post to the front page" option there. Click save and you're done. In the loop, you can check if a post <code> is_sticky() </code> . To loop them, you can use the <code> post__in </code> or...
featuring old articles without messing up with the archive
wordpress
To clarify my question... My plugin is/was using AJAX to call the file <code> pluginname/submit/pick.php </code> My <code> pluginname/pluginname.php </code> contains the usual plugin header and wordpress automatically finds it. Original Question... I'm trying to use the global <code> $wpdb </code> in a plugin to insert...
The short answer The error is because I put a URL in instead of a filepath. and the one line fix is to set <code> $p = '../../../../wp-blog-header.php'; </code> The long answer Following kaiser's link led me down a long road that eventually lead to what I believe is the correct way to do this. in <code> pluginname/plug...
include wp-blog-header not working on MAMP
wordpress
I am developing a site that has two different custom post types; one of them is called Articles and one is called Sketchpad. Sketchpad is user submitted content that is assigned a custom taxonomy term value of either; public or private. Public posts are shown on the site and private posts aren't. The article post type ...
not sure if you'll have tried this yet but you could consider grabbing the two sets of posts separately then merging them. Finally use <code> get_posts </code> to create a combined list sorted the way you want. Something like this might work for you (you may want to add in a posts per page argument to the $args variabl...
Using Query Posts With Multiple Post Types And A Taxonomy
wordpress
Why do we have 2 date fields in the wp_posts? What's the purpose of the post_date_gmt? When does storing the greenwich time get handy?
Some countries use a Daylight Saving Time (DST) : Typically clocks are adjusted forward one hour near the start of spring and are adjusted backward in autumn. Sometimes there is no 2 am. Sometimes you get 2 am two times. To avoid cron jobs running twice or not at all WP needs the GMT (or more precise: UTC ). UNIX time ...
The purpose of the post_date_gmt?
wordpress
I've been working on my WordPress Site for quite some time now, and it's about ready to be deployed. One major issue, though - it's VERY SLOW! At first I thought that the 20 second load time could be attributed to the 100+ images on each page; however, after some analysis, I've come to find that it's taking nearly 10 s...
I addition to the methods you have mentioned, the biggest way to speed up your loading time is with a caching plugin. There are many in the WordPress Plugin Directory , but my favorite is Quick Cache .
Is my host the problem?
wordpress
can I compile some .less-files automatically by using Wordpress. I found just lessphp Thanks Ogni
Alternative see the lessphp Project: https://github.com/leafo/lessphp Works fine and hase an team of contributor. But has not an out of the box function for WordPress; but uts only PHP and the WP has the right Hooks. Do you will only use in themes, then its also fine, that you include this and it works with your requir...
LESS compiler for Wordpress
wordpress
I have two <code> wp_editor() </code> instances on pages and posts used to populate the sidebars of my three-column website. I would like to use the default wordpress word-count script on the two wp-editor areas to get the word-count of the content within them. I enqueued the script and added the required HTML but the ...
Git this to work by using the following line of code in my theme's functions.php. <code> $wordcount = str_word_count( strip_tags( $content ), 0 ); </code> I got this piece of code from a stackexchange-url ("stackoverflow post"). The only disadvantage with this code is that it does not update dynamically which is not a ...
Using default wordcount javascript in Wordpress on custom wp_editor() areas
wordpress
I have upgraded my wordpress from 2.7 to 3.3. Now if I try to change my Permalink /%category%/%postname%/ my home page is loading. However, all my pages are getting 404 page. I dont know how to fix the problem... I got no log.. Then I changed the theme to default theme twenty eleven then also I faced the same issue. Th...
The problem is because in wp_options table I had ./ for home (row id 37)variable. I replaced with ""(blank) now the issue fixed..
Wordpress upgrade from 2.7 to 3.3 Permalink problem
wordpress
I want the email to be sent to different email addresses based on a drop-down Subject value. Can I do this with Contact Form 7?
Use Pipes. See the FAQ: http://contactform7.com/selectable-recipient-with-pipes/ I.e.: <code> [select your-recipient "CEO|ceo@example.com" "Sales|sales@example.com" "Support|support@example.com"] </code>
Can I customize the To Email address on Contact Form 7?
wordpress
I have an example basic wordpress theme template here for you. First, please take a quick look at it to get an idea. <code> &lt;?php get_header(); ?&gt; &lt;div id="primary"&gt; &lt;div id="content" role="main"&gt; &lt;?php if ( have_posts() ) : ?&gt; &lt;?php /* Start the Loop */ ?&gt; &lt;?php while ( have_posts() ) ...
You haven't specified where you want this alteration to apply to so I've applied it to just the home page. You may alter to fit where this filter applies to: <code> &lt;?php function wpse10691_alter_query( $query ) { if ( $query-&gt;is_main_query() &amp;&amp; ( $query-&gt;is_home() || $query-&gt;is_search() || $query-&...
How to order posts by modified date without using 'query_posts'?
wordpress
I want to make my WP code simpler (there's some mess within header.php, page.php etc.). So, for example, I want to set something like this global: <code> $foo = get_option('foo'); </code> So <code> $foo </code> will work properly used anywhere in page.php, header.php, footer.php, loop.php and also within different them...
You could also use this function: <code> set_query_var('foo', $foo); </code> WP will extract and expose all query variables in every template it loads, so you will be able to access it as <code> $foo </code>
Passing variables to templates (alternatives to globalizing variables)
wordpress
I am working on a problem to get the stackexchange-url ("most recently used tags within the last 30 days"). My current thought process is not working, so I am trying to come up with an alternative method. I came across get_term and get_terms , thinking they may be a way to an actual functioning solution to my problem. ...
Simple yet tough question, taxonomies are just groups of categories, while terms are just single categories within these groups.* So, for example, if you create a new post and choose category for it - the category itself is a term, and opening <code> YourWordpressURL/wp-admin/edit-tags.php?taxonomy=category </code> you...
What is the difference between terms and tags?
wordpress
I want to do some (sometimes really complex) stuff on my pages based on pages/posts IDs', Settings API, etc. Now I've all my functions written directly within page.php file, but I don't want it to leave it this way - it's really messy and it's hard to control everything. I'd love to have separate files for each functio...
Globals aren't passed into functions. You have to declare them. Change this: <code> function test() { return $post-&gt;ID; //or echo $post-&gt;ID; } </code> ...to this: <code> function test() { global $post; return $post-&gt;ID; //or echo $post-&gt;ID; } </code>
How to store functions in... functions.php?
wordpress
Hey i know that there are options to post to a wordpress blog remotely by email or by another source. My blog is self hosted. What other ways is there to publish besides via email.
Built in to the current version of Wordpress there is "Remote Publishing" settings for Atom or XML-RPC, but that is geared towards programs that help you blog outside of your Wordpress control panel. You can configure it in the Settings > Writing area of your site's Wordpress dashboard. If you want to publish the conte...
Publishing Remotely To Wordpress?
wordpress
I already checked out this page; http://codex.wordpress.org/Function_Reference/wp_delete_term It does not say what happens to the posts that may have been associated with this action. Hence my question; So, what happens to them?
You can use below to assign all posts to another term during deletion mentioned on same page.. "The $args 'force_default' will force the term supplied as default to be assigned even if the object was not going to be termless." Other wise if there was only one term attached with post, post becomes term less.
deleting terms programmatically
wordpress
I have my plugin setup as such: Main plugin file <code> mouldings.php </code> <code> &lt;?php /* Plugin Name: Moulding Profiles Plugin URI: Description: Creates a 'Moulding Profiles' and 'Idea Gallery' custom post type, creates a 'Wood Types' and 'Categories' taxonomy for 'Moulding Profiles' Version: 0.1 Author: Author...
I believe the issue is that your function that sets up the settings initially isn't getting run upon activation. Add a call to your mouldings_register_settings_initial() in the activation hook, like this: <code> function mouldings_activate() { global $wpdb, $mouldings_options; mouldings_register_settings_initial(); if ...
Default Plugin Settings Not Writing to Database
wordpress
Source ref: <code> do_action('admin_enqueue_scripts', $hook_suffix); do_action("admin_print_styles-$hook_suffix"); </code> Laying aside the obvious difference in base action ( <code> admin_enqueue_scripts </code> vs <code> admin_print_scripts </code> ), what is the syntactical difference between these two? I know that ...
For … <code> do_action('admin_enqueue_scripts', $hook_suffix); </code> … the callback gets the hook suffix as first parameter. Since it is an action you don't have to return anything. You can use it in a rather flexible callback function: <code> add_action('admin_enqueue_scripts', 'wpse_49993_admin_script_callback' ); ...
Difference between do_action('admin_enqueue_scripts', $hook_suffix) and do_action("admin_print_styles-$hook_suffix") syntax
wordpress
I'm using this code. I cannot figure out what the heck is wrong with it? <code> $args = array( 'description',"My Desc", 'slug' =&gt; "My Slug", 'parent' =&gt; 0 ); $result = wp_insert_term("Term1", "category", $args); </code> The result is that term is added, term_taxonomy is added. Slug is added. But the darn descript...
I was having the same problem the other day, due to a completely different typo ;) <code> $args = array( 'description' =&gt;"My Desc", 'slug' =&gt; "My Slug", 'parent' =&gt; 0 ); $result = wp_insert_term("Term1", "category", $args); </code> Note the corrected 'description' element in the $args array.
wp_insert_term does not insert description.
wordpress
Does someone knows what part of wordpress code would I have to modify to be able to just enter into the admin panel without having to login? I need to work on a site but I wont have admin access until a few day (when my friend comes back from vacations), but I do have FTP access (only FTP, no cpanel or any other type o...
I have not tried it, but this thread on stackoverflow.com seems to be what you need - stackexchange-url ("Create new admin, wordpress")
Temporally disable password to login with empty password?
wordpress
I'd like to execute some code everytime my wordpress cron runs, regardless of the timeframe. Is it possible to create an add_action for this? I looked in the filter list but I couldn't find anything relevant. Thanks!
Basically every page load looks to see if there is anything scheduled to run, so by that logic the cron is checked and can possibly run on every page load. I can only presume you want to schedule something to run every so often. If that's the case you need to look at wp_schedule_event() Below is the code to get some co...
add_action to wp cron?
wordpress
Problem I have a page on my site where I need to do additional searching within that page. I am using the default way of WordPress searching with <code> &lt;?php get_search_form(); ?&gt; </code> for my main header search, which works great. I created another HTML form on my page, not using the default PHP method, for t...
The simplest option if you want to show search results within a page context you'll need to do a custom loop, otherwise you won't be able to access the page information. Change the input with the name <code> s </code> to something else like <code> search </code> or <code> q </code> to stop wordpress from doing it's usu...
Display search results within the same page
wordpress
I'm trying to add paging to the query below. However, I can't seem to get the paging to work. It shows previous/next links, however, they always show the same 2 posts. There are 8 posts in this query. <code> //$paged = get_query_var( 'page' ); wp_reset_query(); global $post; $args = array('posts_per_page' =&gt; 2,'page...
If you make <code> paged </code> equal to <code> get_query_var( 'paged' ) </code> that should do the trick. You may need to do something like <code> $paged = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1; </code> and then set <code> paged </code> to <code> $paged </code> .
Adding paging to get_posts()
wordpress
I'm trying to build single-page theme. I want user to navigate thru menu with anchors (for example <code> &lt;a href="#About"&gt;About&lt;/a&gt; </code> ). I've extended Walker for wp_list_pages so it outputs anchors instead of permalinks. How to bite it now? I thought I will use <code> query_posts </code> for <code> '...
I've done a few templates that essentially are on one page. I used this code as the starting block for all of them: <code> &lt;?php $my_wp_query = new WP_Query(); $all_wp_pages = $my_wp_query-&gt;query(array('post_type' =&gt; 'page','posts_per_page' =&gt; -1)); foreach ($all_wp_pages as $value){ $post = get_page($value...
Single-page wordpress theme navigation
wordpress
Ok so long story short, ive been handed a WP site that amongst a few minor changes, needs two specific plugins installed ASAP for the project to be complete. the menu amongst other things is hard coded. each page is also a separate page not feeding from single/page.php"...so if he has about us page etc...its a seperate...
A number of plugins inject some code into <code> wp_head() </code> therefore you need to ensure this is included in header.php. Check, if its not included, add it just before the closing <code> &lt;/head&gt; </code> like so: <code> ... ... &lt;?php wp_head(); ?&gt; &lt;/head&gt; </code> Hope that helps.
hardcoded wp pages/plugins problems
wordpress
I would like to know is there any way/Plugin to limit the user published post (in a given time span) by his role? Like this: Role A -> 1 post per day and 30 post total. Role B -> 10 post per day and 100 post total. Role C -> unlimited. I know there are some plugin out there that have these features but they only able t...
You can use my plugin Posts Creation Limits which has a per user, per role, per post type, per post status limiting system and combined with its <code> post_creation_limits_custom_checks </code> action hook and check if the user has created a post that day already - if so: show the the "limit reached message". For exam...
How to limit user to publish post per day and per role?
wordpress
I have a custom post type and a custom taxonomy located in a plugin. In writing my output loop for the CPT, I'm trying to output all the custom tax items assigned to the CPT items at the top of the page before outputting each individual CPT item. This is what I'm hoping to achieve: tax 1 | tax 2 | tax 3 | tax 4 ... CPT...
Yes there is a way using only one loop but that can be messy and have on resources for large amounts of data, To do that you simple store all of the output as a variable and only output after you finished your loop, ex: <code> $tax_array = array(); $output = ''; while ( have_posts()) { the_post(); $output .= '&lt;div c...
Best Way to Query Custom Taxonomies Used on Custom Post Type
wordpress
I'm a novice and looking to add the wp_editor to a custom metabox textarea field. I've looked seemingly everywhere for an complete example for writing a metabox with a textarea that uses the wp_editor. I am looking for a complete beginning to end example. I do not want to use a plugin. Anyone have a link to a complete ...
There is at least 1 issue with using wp_editor in a meta box, as discussed in ticket #19173(Good read on the subject of wp_editor and meta boxes). TinyMCE gets all messed up if you move the meta box that contains it (specifically, if TinyMCE's location in the DOM is changed). You can, however, use the Quicktags version...
Post custom metabox textarea using wp_editor
wordpress
I got this code ( source ) <code> // split content at the more tag and return an array function split_content() { global $more; $more = true; $content = preg_split('/&lt;span id="more-\d+"&gt;&lt;\/span&gt;/i', get_the_content('more')); for($c = 0, $csize = count($content); $c &lt; $csize; $c++) { $content[$c] = apply_...
All right found a great solution from: http://digwp.com/2010/03/wordpress-post-content-multiple-columns/ functions.php: <code> function my_multi_col_v2($content){ // run through a couple of essential tasks to prepare the content $content = apply_filters('the_content', $content); $content = str_replace(']]&gt;', ']]&amp...
Split columns into three+ divs?
wordpress
I can see two cookies: auth and login cookies in wordpress. Why do we need two? I think one is enough.
"On login, wordpress uses the wordpress_[hash] cookie to store your authentication details. It's use is limited to the admin console area, /wp-admin/ After login, wordpress sets the wordpress_logged_in_[hash] cookie, which indicates when you're logged in, and who you are, for most interface use. Wordpress also sets a f...
why does WordPress need two cookies for auth/login
wordpress
I usually use two steps to retreive a list of posts and the associated metadata: call get_posts(or a custom WP_Query), and then loop through each post returned and retrieve each posts metadata one by one. Is there any way to combine this into a single query? I guess I'm looking for something like a get_posts_with_meta(...
Not worth it as it would be a convoluted query and work against most of the wp caching solutions.
Is it possible to retrieve a post and its metadata at the same time?
wordpress
There are several ways to get the id of a post after it has been saved (auto, etc.), but is there a way to get the post id immediately after you create a new post? I am trying to create a directory using the post id, but I cannot seem to get a static post id. the code below seems to work but I get an auto incremented i...
Try this... <code> add_action('post_updated', 'myfunction'); function myfunction( $post_id ) { global $post; if (!file_exists("/www/foo/blog/wp-content/uploads/" . $post_id)) { mkdir("/www/foo/blog/wp-content/uploads/" . $post_id, 0777); } } </code> NOTE: Change from <code> save_posts </code> to <code> post_updated </c...
Get the post_id of a new post
wordpress
My desktop version of wordpress theme requires using a 'static' page as the start page as it has custom shortcodes etc. While this is good, when it comes to my mobile theme, sadly the 'static' page is being displayed and because its a different theme, the shortcodes are not being executed. Is there a way to tell a mobi...
Just wrap you code up in a conditional: <code> if ( $GLOBALS['is_iphone'] ) { // do funky stuff for mini screens } </code> <code> global $is_iphone; </code> will trigger <code> TRUE </code> for all mobile devices incl. tablets. Edit for WP 3.4+ Now there's <code> wp_is_mobile() </code> to make checks for <code> User-Ag...
How to set different settings for a mobile theme?
wordpress
I have a category called "javascript" and it's limiting my list to only 4 entries? <code> &lt;?php get_header(); ?&gt; &lt;div class="container"&gt; &lt;div class="row"&gt; &lt;div class="decorate"&gt; &lt;h1&gt;Javascript&lt;/h1&gt; &lt;?php if (have_posts()) : ?&gt; &lt;?php while (have_posts()) : the_post(); ?&gt; &...
This has nothing to do with the loop in the template file. Check Settings> > Reading> > "Blog pages show at most..." That setting is the default setting for Archives, too, as well as Search results, etc. Use WordPress › Custom Post Limits « WordPress Plugins to vary posts limits in categories, archives, etc.
Archive template limiting to 4 entries?
wordpress