question
stringlengths
0
34.8k
answer
stringlengths
0
28.3k
title
stringlengths
7
150
forum_tag
stringclasses
12 values
I'm building a set of plugins... obviously, being plugins, they need to be suitable to a variety of installations. These plugins will keep track of specific types of user activity (namely whether links are clicked, actions taken, petitions sighned, that sort of thing) and provide access to the resulting data to the adm...
This is one of the few cases i would prefer using custom database tables since you are talking about lots of records (10,000 - 100,000) and since Custom post types use the posts table which will hold many empty fields in the case you describe. But i guess there is no right or wrong way to do that and it's a matter if o...
Custom Post Types vs Database Table where many (10,000s + ) of entries are possible/desirable
wordpress
I'm having some trouble with this. I'm not sure how to do it the correct way, and I read so many different techniques and ways to do it that I don't know what to make of it. Some questions and troubles I have: - Should I deregister the jQuery that is included in WordPress at all? I'm doing it right now with the followi...
First rule of thumb: do not deregister core-bundled scripts and replace with other versions , unless you are absolutely certain that no Theme, Plugins, or core itself will break due to the version change. Really, unless you absolutely need an alternate version of a core-bundled script, just use what is bundled with cor...
Including jQuery and JavaScript files the correct way
wordpress
stackexchange-url ("This answer") is very close to what I am looking to do, but instead I would like to specify a specific custom field and display a select menu of its available values. Thanks!
Simple to do, first create the dropdown with just the meta values you want and then catch the submit of the filter, just change <code> POST_TYPE </code> to the name of your post type and <code> META_KEY </code> to the name of your meta key: <code> &lt;?php /* Plugin Name: Admin Filter BY Custom Fields Plugin URI: http:...
Add filter menu to admin list of posts (of custom type) to filter posts by custom field values
wordpress
Is it possible to limit a search for keywords to a specific post type (say 'news') but filter the results by selected custom taxonomies? I have a news section. This has the custom post type called 'news'. This then has the custom taxonomy 'news-category'. There are several custom taxonomy terms that need to be listed w...
It's fairly inefficient to use <code> query_posts </code> and I often find it's more trouble than it's worth. Instead, to set the post type you can just have a hidden input inside the form with name 'post_type' and value (in this example) 'news'. WordPress handles the rest. Unfortunately it is not so easy with taxonomi...
Keyword search limited to specific post type filtered by multiple custom taxonomies?
wordpress
My pagination pages echo out the same content on every page. Page one is queried to show two posts, which it shows up correctly. Page two shows the exact same two posts as page one does. Here is my code: (functions.php) (this is a pre-made code I found on the web). <code> function wp_corenavi() { global $wp_query, $wp_...
This is because <code> query_posts </code> resets the query. See this warning on the Codex page: Pagination won't work correctly, unless you use query_posts() in a page template and you set the 'paged' query var appropriately: http://scribu.net/wordpress/wp-pagenavi/right-way-to-use-query_posts.html The call: <code> qu...
Pagination Not Working (pages duplicating content)
wordpress
I am trying to find the feature to add a page template. I am adding an archive but when I go into pages-> Add New-> I get no option in the sidebar to use the existing archives.php file I want to use. Can anyone help me out?
Archives.php is a template file that WordPress will use by default (if it exists). If you want to create a custom page template you need to create a new template file in your theme. You can read all about it here , but I'll provide an example below. Put this at the top of your new file: <code> &lt;?php /* Template Name...
Custom Page Templates
wordpress
how can I add a &lt;--more--> tag directly in the template? I mean, the exact php code to use in a template for that shortcode. I need it for a script that makes use of that shortcode to hide content and having to add the "more" shortcode by hand through all the posts would be such a task any help appreciated!
The code would probably be something like this: <code> echo '&lt;a href="' . get_permalink() . "#more-{$post-&gt;ID}\" class=\"more-link\"&gt;".__( 'Read more &amp;gt;', 'your-theme' ). '&lt;/a&gt;'; </code> Check out the source on how WordPress does it: http://core.trac.wordpress.org/browser/tags/3.3.1/wp-includes/pos...
how can I add a "read more" tag directly in the template?
wordpress
WordPress itself, in the <code> wp-content </code> folder, includes an empty PHP file which looks like this. <code> &lt;?php // Silence is golden. ?&gt; </code> Should plugins include an empty file like this as well to stop folks view viewing the contents of a directory? What about additional folders in themes -- like ...
I am going to say YES. Security through obscurity works if your more obscure then your neighbors :) (joking but there is some truth to that). The reality is that the bots/scanners now compile the plugin lists right off wordpress.org and crawl the plugin url's directly, fingerprinting versions for know exploits and keep...
Should Plugin Folders Include a Blank index.php File?
wordpress
I used this nettuts tutorial to create an options panel. What I'm trying to figure out how to do and have been unsuccessful doing so far (I keep "breaking" the code/getting a server error) when I try to add current user info... I have 3 custom options I want available to clients while the rest are available to the admi...
The correct capability for editing Theme options is <code> edit_theme_options </code> . This capability is only available by default to users in the Administrator role . So, if you're trying to make Theme options available for configuration by non-admins, it won't work unless you also give the appropriate capability to...
Custom options page for themes
wordpress
In my application, i have one form. Now if user is in front end i want to display the title but if he is in back end i do not want to display it. I do not want to check it based on user role.
Use <code> is_admin() </code> . It checks if you're viewing an Admin page, means the backend.
How to check if user is in back end?
wordpress
I have a query that is meant to return user details from Wordpress tables. It would be fine if I was just SELECTing column names that I want, but within Wordpress there is a usermeta table which has 2 columns - 1 called metakey and 1 called meta value. I want to get certain bits of user info from meta keys such as firs...
How about a Pivot Query? This would return rows that have first_name,last_name,user_login. You could then add whatever condition you wanted using a WHERE clause. <code> SELECT MAX(CASE WHEN wp_usermeta.meta_key = 'first_name' then wp_usermeta.meta_value ELSE NULL END) as first_name, MAX(CASE WHEN wp_usermeta.meta_key =...
Using GROUP CONCAT in my-sql query with wp_usermeta table
wordpress
I have this in a php file from Contact Form 7, which I load into a modal window (FancyBox) and I would like to close it after the user will press the Submit button . I was thinking of adding onSubmit="action" to the form but I don't know how or which one is the function I am supposed to use to close the modal window? <...
Contact form 7 Lets you call a JavaScript function after the form has been submitted You will find the Additional Settings field at the bottom of the contact form management page and you need to use the hook named <code> on_sent_ok </code> something like this: <code> on_sent_ok: "$.fancybox.close();" </code>
Close modal window after form submit
wordpress
I have a self hosted blog and I want it to be mobile compliant. I know there is a free plugin the serves this purpose. However, I want to use a simple mobile theme I like (say from Theme Forest). How do i go about it? Is it as straight forward as uploading a normal theme?
This depends on the theme in question, Some themes have a desktop and mobile versions built in. Some themes are made to fit the screen size (responsive). Some themes (for mobile) come as a plugin which activates it self when the user access the site from a mobile device. So In the either way its a matter of activating ...
How Do I Use A Custom Mobile Theme?
wordpress
The question title is pretty self-explanatory - I don't really like the new Admin's bar's colour but I find it useful and want to keep it so I would like to change the colour of it. However, I'm not the best at web scripting, let alone CSS so I wondered if anybody here would help me to make the Admin Bar the following ...
There's a good plugin to make the admin bar blue in both the admin and front-end: http://wordpress.org/extend/plugins/blue-admin-bar/ If those colors don't suit, play around with the plugin to figure out how to do your own. The key thing to notice about the plugin version is that by using a hook to enqueue the styleshe...
Making that Admin Bar transparent or a blue color
wordpress
I've been using metaboxes for a while now, and enjoyed their flexibility. However, I am now in a situation where I need the metabox to appear only for a specific single post or page , and not for the whole (custom)-post-type. Is it possible to do so? Your kind assistance would be most welcomed. TIA Matanya
Since you are familiar with the how to create metabox using <code> add_meta_box </code> already, I'll skip to the relevant bits. You can either conditionally <code> add_meta_box </code> depending on the current post title, or ID, (this is the preferred method) or, you can conditionally <code> remove_meta_box </code> de...
Attaching a metabox to a single post
wordpress
I will explain the problem more clearly. I want to create a page which will show three blocks. At the top: It will show one post . ( An issue of a Magazine. PDF in a post) At the center: It will show all the articles from the magazine. ( Posts from the issue of magazine) At the bottom: It will show other issues of maga...
I'd say you'd be looking at custom post types. Google custom post types and taxonomies and do a bit of study on that front and then you should know more about what you want to actually display. I could be misunderstanding you but doubt if categories in the blog is where to go with this, CPT's do something similar but a...
Categorize posts on a page o the basis of category of other post on the same page
wordpress
I can't get any help on the buddypress forums so I'm going to ask it here. I'm trying to use conditional tags so I can have a different sidebar for the profile page than the activity page. For some reason the way I have it setup in my sidebar.php still returns the default. Any suggestions? <code> &lt;?php if (is_single...
Your problem may be the choice of <code> bp_is_user_profile() </code> . This only returns true when you are literally looking at the xprofile component - the 'Profile' tab of a user's page. <code> bp_is_user() </code> is more general, returning true whenever you're viewing a user page (even if it's user activity, user ...
Conditional tags to differentiate between profiles and activity with buddypress
wordpress
I have a list of products, each with a price in a custom field stored as text such as "2.50" or "5.00" and I am displaying them on the page with a custom query that sorts by the price: <code> if(!$wp_query) { global $wp_query; } $args = array( 'meta_key' =&gt; 'price', 'orderby' =&gt; 'meta_value_num', 'order' =&gt; 'A...
The <code> OrderBy </code> argument can take more then one parameter so the solution was to change : <code> 'orderby' =&gt; 'meta_value_num', </code> to: <code> 'orderby' =&gt; 'meta_value meta_value_num', </code>
Using Orderby and meta_value_num to order numbers first then strings
wordpress
Is it possible to limit access to a page using wordpress user roles that isn't included in the wordpress install. For example I have a CS Cart install with only a couple of products but I need to limit access to these pages to certain users. Can I add something in to my CS Cart install to call on Wordpress to be able t...
if you can include the <code> wp-load.php </code> from WP install; after this you can use all WP Core functions and can also check the user and his rights with core function - <code> current_user_can() </code> . But maybe it's easier to create an bridge from CS Cart to WP, if CS Cart has an own user table; i dont know.
Restrict access to non-wordpress section of site with user roles?
wordpress
Calling Post ID: Lets go first with calling post id definition :) This name i actually find inside a core file <code> wp-admin/includes/media.php </code> which means for the post you requested the media upload. Media gets attached to the that post which the media uploader gets called. Question: Well, for new post (when...
You are on the correct path on thinking about <code> post-edit.php </code> . http://core.trac.wordpress.org/browser/tags/3.3.1/wp-admin/post-new.php#L45 See how <code> get_default_post_to_edit </code> is called to return a new post. The second argument tells it to create a post in the database. The function is defined ...
How to get future ID for post which haven't been created yet?
wordpress
I would like to use toggle option in my sidebar widgets. But my sidebar widgets not generating unique id. This is my register sidebar code. <code> register_sidebar(array( 'name' =&gt; 'Main Sidebar', 'before_widget' =&gt; '&lt;div class="widget %2$s"&gt;', 'after_widget' =&gt; '&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;', 'b...
The <code> after_title </code> does not go through any transformations. In fact only the <code> before_widget </code> does: http://core.trac.wordpress.org/browser/tags/3.3.1/wp-includes/widgets.php#L876 However, a little lower you can see that <code> $params = apply_filters( 'dynamic_sidebar_params', $params ); </code>...
Toggle option in sidebar widgets
wordpress
I have a page, with a shortcode that get all the post from a categorie and put after the content of the page. For no apparent reason, the result of a WP_Query() in the shortcode APPEAR ALWAYS at the top of the page. If i put the shortcode a the top OR at the bottom, the post (3 of them) appear before the content of the...
codex the_title() replace this <code> $mypost .= the_title(); </code> with <code> $mypost .= the_title('','',false); </code>
The result of a shortcode appear BEFORE page content
wordpress
I have 3 post, post1=text, post2=text and gallery1, post3, text and galery2 I like to list ALL the post from one category, and the result is all the data get out, but the gallery associated with the post is ALL THE SAME. yep the second post and post#3 have the same picture... the problem, the shortcode of gallery is as...
Hourray : find it : do_shortcode do the trick ! here is the final code : <code> // -------------------------------------------------------------------------------------------------------------------- //Add a ShorCode to get a page/post content add_shortcode ('post_cat3','get_post_cat3'); function get_post_cat3 ($att) {...
Multiple post back-to-back display only one gallery
wordpress
I am trying to run the following jQuery to change the text of my username and password boxes so that they do not need a label (inside <code> &lt;script&gt; </code> tags): <code> jQuery(document).ready(function($) { $('#user_login1').val('Username'); $('#user_pass1').val('Password'); $('#user_login1').focus(function(){ ...
This is what I had to do to get it to work Add the following right after <code> &lt;head&gt; </code> in <code> header.php </code> <code> &lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"&gt;&lt;/script&gt; </code> Rem out any reference to <code> wp_enqueue_script('j...
jQuery conflict
wordpress
I have a custom post type called "media" and I would like to be able to upload a single pdf called, "presskit" for the archive page that contains ALL of the media custom posts. I only need to upload / associate a single PDF with the archive...it would be nice to make this is a submenu page, i.e. something like: <code> ...
I recommend this plugin all of the time even though I have no association whatsoever with the plugin or the author of it. It's free and allows you to add custom upload fields and all kinds of goodies to your edit screens without touching code. It's called Advanced Custom Fields . Some developers would frown upon sugges...
attach a PDF to an archives template?
wordpress
I always do changes on the Wordpress plugins for clients. But these changes are always in danger to be lost if the plugin is updated. Is there is a way to make a plugin for another plugin in Wordpress? Is there is a way to preserve the changes or re-apply it after each plugin update.
I think best way to do this is via actions and filters, like we extend WordPress core itself. Other options is like @helgatheviking pointed, if plugin is class you can extend it. Unfortunately not all plugin developers provide useful filters and actions with their code, most often plugin isn't written in OOP manner. On...
How to create a Wordpress plugin for another wordpress plugin?
wordpress
I noticed that any shortcode that is not part of the contact form 7 builtin shortcodes dont work. For example: I am trying to use an accordion shortcode between form elements in contact form 7. But the code dont work. How to solve this without editing contact form 7 core files?
There's two ways to do what you're wanting. First way is to add this code to functions.php of the Contact Form 7 plugin: <code> add_filter( 'wpcf7_form_elements', 'mycustom_wpcf7_form_elements' ); function mycustom_wpcf7_form_elements( $form ) { $form = do_shortcode( $form ); return $form; } </code> That allows you to ...
How to use other shortcodes inside Contact form 7- forms?
wordpress
I am trying to update the permalink structure using the back-end and Settings -> Permalinks. The <code> .htaccess </code> file is not updating. I have given <code> .htaccess </code> full access with <code> chmod -R 777 .htaccess </code> and still, Wordpress says that the permalinks are updating, yet they aren't coming ...
If you have given the correct access and the problem still isn't resolved, but WordPress says that it is indeed modifying the file I think you should double check and make sure the rewrite_module is on. If you're site is live and you're having this problem you need to call your hosting service and they'll be able to he...
Permalink Structure not updating .htaccess
wordpress
I have a anchor tag that wraps around my logo image that takes you back to the home page using the following <code> &lt;a href="&lt;?php bloginfo('url'); ?&gt;"&gt;&lt;img src="&lt;?php bloginfo('template_directory'); ?&gt;/images/logo.png" alt="Good Morning Moon"/&gt;&lt;/a&gt; </code> It is inside my header.php file....
The code you're posting should work, as far as I can tell; however, you're using some outdated template tags. Try replacing <code> bloginfo( 'url' ) </code> with <code> echo home_url() </code> , and <code> bloginfo( 'template_directory' ) </code> with <code> echo get_template_directory_uri() </code> , like so: <code> &...
anchor tag in header not working on other pages except the home page
wordpress
When I create a page with a default template and parent set to no parent, with the permalinks name being <code> sitename/blog </code> the css on that page gets messed up(including the admin bar is all messed up), if I change the permalinks structure to <code> sitename/blogs </code> it works perfectly fine. Also if I ch...
On your wordpress menu use another class instead of "blog" for the blog item, cause your theme has a function that add a similar class to the body so it's creating a conflict in there, try erasing your blog class for you to notice. Also the app.css if for ur custom css :), no need to use both.
when I create a page with a /blog permalink the css gets messed up
wordpress
I'm attempting to modify the latest version of the mystique theme, and would like to have it so when I select a background, the page will lock that background into page, but have the content scroll over top of it. Currently the content scrolls, but the background scrolls with it, leaving an awkward spot where the backg...
I think you're looking for css's fixed background: W3 background definition Here's an example from W3. Something like this in CSS should work: <code> background: transparent url(images/bg.jpg) no-repeat fixed; </code> And if you want the background stretch/scale 100% width and height of user's screen, you should check ...
How to have content scroll over background
wordpress
I am trying to write a plug-in to display the RunKeeper Healthy button on single posts, but my output has an extra space and double-quote when I look at the page source. What I'm trying to do with the button is open a new window via inline JavaScript. I've tried switching between single and double quotes and have also ...
I fixed this by switching the string concatenation to use PHP's echo instead of doing string concatenation. I also noticed I had a missing parenthesis in my original code (which didn't affect the result of the output where the single quote was turned into a double-quote). I still have no idea why I was getting a single...
Inserted double quote when prepending to the_content
wordpress
I'm trying to get three values from all my custom posts, to populate a Google Map with the places where I've been. All is going fairly well, except for an issue I'm having with <code> get_the_term_list </code> . For some reason it adds the number "1" in front of each correctly returned value. As an example, my below co...
The problem lies with the get_the_term_list() function, which is defined with the following arguments: <code> get_the_term_list( $id = 0, $taxonomy, $before = '', $sep = '', $after = '' ) </code> You're defining the <code> $before </code> argument as true which PHP prints as 1 so that's why it's printing a 1 before the...
Get_the_term_list inexplicably adds values in foreach
wordpress
I wish to use the wp_mail_from hook to change the from email address submitted through a form which sends an invitation to a friend by email (I am writing my own plugin to do this). I am using the following code to at present but I cannot see what I am doing wrong as the from email address is not set at all and goes to...
After further investigation things seems to work with sendmail without the WP SMTP plugin. I have also been told by others that the WP SMTP plugin is needed to get email working on Windows hosts and is not needed if running your website on Linux. Hence, I think this was more to do with a specific plugin that to do with...
wp_mail_from not changing from address
wordpress
Absolute beginner question: I need to load text into specific div tags across the page. On my html mockup its a lorem ispum text box waiting for wordpress to load the real content. So, how do i control the real content and its relation with the div box text on the page? Can it be a post, so i can manage it from the das...
You can solve this in different ways. One it's to use simple querys with WP_Query and using the p parameter to retrive a particular post like it's explained here . Something like this: <code> $the_query = new WP_Query( 'p=123' ); while ( $the_query-&gt;have_posts() ) : $the_query-&gt;the_post(); the_content(); endwhile...
How to load a post into an empty div tag anywhere across the pages?
wordpress
I'm looking for a simple plugin that allows me to manage groups of images. Wordpress does this, but you would need to link the gallery to a page or post. Since i'm looking to create a site banner with dynamic images, i don't want to link a gallery to an specific page. Is there a good image manager plugin for this simpl...
You could try the Media Library Categories plugin to add categories. It does a wonderful job of adding category functionality, but the code could be improved upon and custom implementation requires some knowledge of PHP, as it only provides you with a shortcode and no documentation. This stackexchange-url ("Question"),...
Image Manager Plugin
wordpress
I'm looking for a way to expand e customize more this topic stackexchange-url ("how to filter post listing (in WP dashboard posts listing) using a custom field (search functionnality)?") I've a custom post type in the dashboard i've managed to have a small search box with a fixed search function to search a specific me...
I'm assuming you've used the method in the question linked to and are using the <code> restrict_manage_posts </code> filter. <code> add_action( 'restrict_manage_posts', 'my_search_box' ); function my_search_box() { // only add search box on desired custom post_type listings global $typenow; if ($typenow == 'product') {...
filter custom post type by meta key in dashboard
wordpress
I want to use custom post type in my web app and want to use that url in my plugin menu. I have created custom post type like this. <code> register_post_type( 'reserve', array( 'labels' =&gt; array( 'name' =&gt; __( 'Reserves' ), 'singular_name' =&gt; __( 'Reserve' ), 'all_items' =&gt; __( 'All Reserves' ), 'add_new' =...
You're passing <code> edit.php?post_type=reserve </code> as first parameter and that should be parent menu slug. Instead pass it as <code> menu_slug </code> parameter, see code snippet below. <code> add_submenu_page( 'reserve/admin', 'Reserve', 'Reserve Builder', 'view_reservation_plugin', // $capability 'edit.php?post...
Hide custom post type and use its slug in new plugin menu
wordpress
I'm creating a featured post slider which takes 4 pages or posts from the 'featured' category. I'm trying to use WP_Query, but am having no joy :( my slider query is: <code> $ml_featured = new WP_Query( array( 'posts_per_page' =&gt; 4, 'post_type' =&gt; array('page', 'post'), 'category__in' =&gt; 22 ) ); if( $ml_featur...
First of all, <code> while( have_posts()): </code> should be <code> while( $ml_featured-&gt;have_posts()): </code> And secondly, in your <code> pre_get_posts </code> callback you check: <code> false == $query-&gt;query_vars['suppress_filters'] </code> But this returns true for every <code> WP_Query </code> query and an...
cannot override post_types in WP_Query()
wordpress
I'm using two plugins which use the_title, but one (while still completely functional) is showing an error on certain pages. Missing argument 2 for pfund_handle_title() in ...wp-content/plugins/personal-fundraiser/includes/user.php on line 639 I'm told it's because it doesn't pass the second required parameter of the_t...
I have this issue in some of my own plugins, and it's an easy fix. Basically, I label this a "lazy developer" issue. It's a matter of someone adding a filter but not taking optional parameters into account. Step 1 - Edit the plugin file The code that's breaking starts around line 639 (according to your debug info): <co...
Two plugins using the_title; one not passing second param.
wordpress
Im a bit lost on this simple problem so i thought id come and ask the pros. Ive just been told by my client that on their sites gallery, the name and description are on the same line. so for example if the picture is called ABC, and the description is "123". the output is "ABC-123" all on one line.so itd look like: <co...
Well just in case, anyone is looking at this, i solved the problem by manually inserting a <code> &lt;br/&gt; </code> tag in the caption area. so for example if the pictures content has this sample text <code> "ABC-123" </code> which outputs this <code> -------- | Picture | -------- ABC-123 </code> then in the caption ...
How do you modify the HTML output of a Gallery item (using the gallery shortcode)?
wordpress
I want to show post count for all child categories shown, but not for their parent categories. Or, since there are only 3 parent categories, this exclusion could be per category id. Is there a way to do that? Also, unfortunately, the number doesn't come wrapped in any element, so I can't think of any way of hiding it C...
Check out stackexchange-url ("this") post. It shows you how you can wrap the count with any element you'd like so that you can manipulate it as you see fit.
wp_list_categories with show_count, except for specific categories
wordpress
What is the advantage of using <code> wp_mail() </code> over <code> mail() </code> . Codex says they're similar, but they seem to be very similar.
<code> wp_mail() </code> is a pluggable function: It can be replaced by plugins. That’s useful in cases where the regular <code> mail() </code> doesn’t work (good enough), for example when you need extra authentication details. Example: WP Mail SMTP <code> wp_mail() </code> uses PHPMailer by default, a sophisticated PH...
What is the advantage of using wp_mail?
wordpress
What is the difference between <code> strip_tags </code> and <code> wp_filter_nohtml_kses </code> . I tried to figure wp_filter_nohtml_kses from the source but it looks like it does something a bit more complex than strip all html even though thats what the codex says. I think the kses functions are expensive so I wond...
Technical difference is kinda obvious. PHP one is single function, using logic in PHP code. WP one is one of family of functions, based on third party KSES library. Is there practical difference between these two specific functions? I think the important point is that <code> strip_tags() </code> was made for utility , ...
What is the difference between strip_tags and wp_filter_nohtml_kses?
wordpress
I am working on developing a plugin, and I am trying to add a line of text to the bottom of the page, I see there are two actions that seems reasonable, <code> wp_footer() </code> and <code> get_footer() </code> . wp_footer sounds like it may more suited towards code that needs to go at the very end of the page (like J...
These two functions accomplish two different things. <code> wp_footer() </code> is a hook used in your footer.php template file to ensure that the right code is inserted (from the core/plugins/etc) into the right place. <code> get_footer() </code> is used in your other template files to call for the code in your footer...
What is the difference between the "wp_footer" and "get_footer" actions?
wordpress
I am developing a wordpress theme and I want to use <code> jQuery.load() </code> to load data from a PHP file in my theme directory called <code> process.php </code> to a div in a wordpress page template. I haven't had any issues with <code> load() </code> in the past but Wordpress is preventing me from loading the dat...
You might find this informative, not sure if it will cover what you need but it explains a lot about front end Ajax for WordPress which is not exactly intuitive and it might help you out. In particular you probably need to understand how admin-ajax.php works.
Allow access to stand-alone php file Wordpress
wordpress
I have created a Menu (for the nav bar) it is placed in a copy of the header.php file in my child theme right below: <code> &lt;?php wp_nav_menu( array( 'container_class' =&gt; 'menu-header', 'theme_location' =&gt; 'primary','container' =&gt; '' ) ); ?&gt; </code> It works fine EXCEPT the CSS for the Active Selected me...
I forgot to add this is for BUDDYPRESS This worked: Add to functions.php: <code> //--Current Page URL function curPageURL() { $pageURL = 'http'; if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";} $pageURL .= "://"; if ($_SERVER["SERVER_PORT"] != "80") { $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_S...
CSS for Created Menu "Active Selected" not working, everything else is!
wordpress
I have added a custom field to user profiles in bbPress however I am unsure how to do form validation other than javascript. I would like to do some PHP validation however the few things I have tried didn't work. If you fail to enter an email it will say "ERROR: Please enter an e-mail address." after you have submitted...
I worked it out. <code> add_action( 'user_profile_update_errors', 'validate_steamid_field' ); function validate_steamid_field(&amp;$errors, $update = null, &amp;$user = null) { if (!preg_match("/^STEAM_[0-5]:[01]:\d+$/", $_POST['_bbp_steamid'])) { $errors-&gt;add('empty_steamid', "&lt;strong&gt;ERROR&lt;/strong&gt;: Pl...
Form validation on user profile edit
wordpress
This is a question based on the comments from the answer stackexchange-url ("here"). I'm using the following code to create a couple of different search boxes for my website: <code> &lt;form action="&lt;?php echo home_url( '/glossary/' ); ?&gt;" method="get"&gt; &lt;p style="font-size:12px;"&gt;SEARCH&lt;strong class="...
Most unfortunate, while my original solution was elegant I did not foresee this complication, and I apologise for the inconvenience. So, I provide an alternative solution. Firstly to get your fancy search query: Your markup will need to change, but this will intercept the URLs and rewrite them correctly internally, it ...
Custom Post Types: pretty search URLs and has_archive
wordpress
As we know WordPress supports multiple tag queries (',' and '+'). The only problem with this <code> add_query_arg() </code> doesn't handle these methods if a query param is already exists in the URL. From the following url <code> www.domain.com?post_type=ptype&amp;param=value1 add_query_arg('param', 'value2') </code> w...
<code> $url = parse_url( $your_url ); $query = $url['query']; $args_arr = array(); parse_str( $query, $args_arr ); if( isset( $args_arr['param'] ) ) { $query_string = $args_arr['param']; $query_string .= ',value2'; } else { $query_string = 'value2'; } add_query_arg( 'param', $query_string ); </code> That's completely u...
Generate multiple tag query URLs
wordpress
I have a page called <code> my-todo-list </code> and is using a custom page template. The page is accessible via this type of URL : <code> http://domain.com/my-todo-list/ </code> Now I need to paginate it, and I want to look like this: <code> http://domain.com/my-todo-list/page/1 </code> I've read a lot of questions he...
What you will want to use is <code> get_query_var( 'paged' ) </code> . This will get the default pagination value, this should be set by default, so you should just be able to plug and play. Because there are no URL parameters due to rewriting, <code> $_GET[] </code> will be completely empty (at least on the example UR...
custom template rewrite
wordpress
Using the new <code> WP_Screen </code> class makes it pretty easy to add help text to a screen. <code> &lt;?php add_action( "load-{$somepage}", 'wpse_load_reading' ); function wpse_load_reading() { get_current_screen()-&gt;add_help_tab( array( 'id' =&gt; 'my-help-tab', 'title' =&gt; __( 'My Title' ), 'content' =&gt; __...
As @Mamaduka suggested, you can hook into <code> admin_head-{$page_hook} </code> and add the contextual help there. <code> admin_head </code> fires after the default contextual help tabs have been added. <code> &lt;?php add_action( 'admin_head-options-reading.php', 'wpse45210_add_help' ); function wpse45210_add_help() ...
Positioning Screen (Contextual) Help Tabs
wordpress
I am trying to place <code> my_javascript_file </code> in the footer. According to the documentation <code> $in_footer </code> is the fifth value and it is a boolean so I have it set to <code> true </code> . Currently it doesn't show up anywhere, as far as I can tell from inspecting the code. Got it to work, it was hid...
You have <code> true </code> set in the 4th parameter (version), not the 5th. <code> wp_enqueue_script( 'my_javascript_file', //slug get_template_directory_uri() . '/javascripts/app.js', //path array('jquery'), //dependencies false, //version true //footer ); </code> Also, as someone else mentioned, drop jquery enqueue...
wp_enqueue script my_javascript_file in the footer
wordpress
I am using the following code below in my functions.php, However app.js is not found when I inspect it in the resources tab. It is looking for it in http://localhost:8888/goodMorningMoon/javascripts/app.js?ver=3.3.1 when it should be looking in http://localhost:8888/goodMorningMoon/wp-content/themes/Good-Morning-Moon/j...
You need to reference your WordPress template directory when you register the script. Change this: <code> wp_enqueue_script('my_javascript_file', '/javascripts/app.js', array('jquery')); </code> ...to this: <code> wp_enqueue_script('my_javascript_file', get_template_directory_uri() . '/javascripts/app.js', array('jquer...
wp_enqueue_script not loading my custom js file
wordpress
I'm trying to store an image generated with <code> imagecreatefrompng() </code> using the Transients API , but it just stores an empty string ( <code> string(0) "" </code> ). Also, I notice if I set the transient before <code> imagedestroy( $im ) </code> , the image is broken and doesn't display at all (broken image th...
<code> imagecreatefrom* </code> functions return an image resource identifier, which when cast to a string (saving an option) will result in an empty <code> string(0) "" </code> container. Raw images created by these functions do not have any specific data structure that can be serialized out of the box. Two solutions ...
How can I store an image in the database with Transients API?
wordpress
Say that I want to make a post type called 'press' and it is mostly concerned with linking a title with a PDF document of a press clipping. I want to show all of these as an archive... so something like site.com/press but i don't want any single post template pages. so no site.com/press/article1 or site.com/press/artic...
The fast way In your .htaccess add a rule <code> RedirectMatch Permanent ^/press/.+ /press/ </code> Plugin way Hook into <code> template_redirect </code> and redirect all requests to a single entry: <code> add_action( 'template_redirect', 'wpse_45164_redirect_press' ); function wpse_45164_redirect_press() { is_singular...
Prevent access to single post types
wordpress
I have a 3 level deep navigation menu which will show beside all pages on the site except the homepage. The issue is only 2 of my 3 levels are showing in the menu when displaying it using the wp_nav_menu. I've tried specifying the depth parameter and without it to no avail. I am using the Roots theme if that helps. See...
I finally solved the issue, it was due to a default value in the Roots theme overriding the depth parameter for a hook called wp_nav_menu_args (which I didn't even know was a hook). The code can be found in the root directory of the theme in the "inc" folder, a file called roots-cleanup.php. The original code looks lik...
3 Level Deep Navigation Menu Not Showing All Levels
wordpress
I would like admins to be able to delete users from the frontend with the click of a button. How could I use the wp_delete_users() function to create such a button on the frontend if the user ID is provided?
You could use AJAX to request a custom 'action' and send the users' ID. Alternatively 'post' the action and user ID to the same page. They are both essentially the same thing, but the former doesn't require the page to be reloaded. There are plenty of topics on this site that deal with AJAX, so I'll omit the details (c...
Deleting users from front-end with wp_delete_user()
wordpress
I want to display the current page number in the site. I want it to be conditional though so that it doesn't show up on the home/front page. Using the code below, the page number is being displayed at all. <code> &lt;?php $pageNumber = (get_query_var('paged')) ? get_query_var('paged') : 1; if(!is_front_page()) { echo "...
You want to use <code> is_paged </code> which checks if the current page number is 2 or above (and returns true if it is). <code> is_front_page </code> checks 'if the main page is a posts or a Page'. You've also used incorrect syntax (changed from a double quote to a single quote, and used <code> &lt;?php </code> insid...
Displaying Current Page Number Conditionally
wordpress
I would like to build on stackexchange-url ("this answer") so I can incorporate pagination and a couple of other features. We have over 1,600 entries in our Glossary so certain letters have far more than 20 (my max posts/page) entries. If a user clicks "A" or accesses "/dev/glossary/a" I'd like them to see a list of al...
Something like this should do the trick for ordering by title, and using pagination: <code> global $wp_rewrite, $wp_query; if ( have_posts() ) : while ( have_posts() ) : the_post(); ?&gt; &lt;header class="entry-header"&gt; &lt;h1 class="entry-title"&gt;&lt;?php the_title(); ?&gt;&lt;/h1&gt; &lt;/header&gt;&lt;!-- .ent...
Single parent post lists child posts with pagination
wordpress
I have this piece of ode in a buy template. I like to know what to add to get the child name of the category the mais display category is sponsor. but in the sponsor category, there is : gold, silver, platium... i want to get that "color" category an output it as <code> &lt;div class="cat-name"&gt;platium&lt;/div&gt; <...
menardmam, this is my solution: <code> &lt;?php $showPostsInCategory = new WP_Query(); $showPostsInCategory-&gt;query('cat='. $carouselCategory .'&amp;showposts='. $carouselNumber .''); if ($showPostsInCategory-&gt;have_posts()) : while ($showPostsInCategory-&gt;have_posts()) : $showPostsInCategory-&gt;the_post(); ?&gt...
Get Child category "name" of post
wordpress
I've set up a custom post type which has three custom meta fields: name, latitude, longitude. Each post already shows the name on an integrated map based on it's latitude and longitude. I now would like to add a page to my site which shows ALL the names on a map based on their latitude and longitude. I obviously know h...
If all of your custom post type posts have all meta fields that you need then you can use the <code> fields </code> argument and set it to <code> ids </code> which will work much faster for example: <code> //get your custom posts ids as an array $posts = get_posts(array( 'post_type' =&gt; 'your_post_type', 'post_status...
Return all custom meta data for one custom post type
wordpress
In my custom query, every time I query for posts from a particular category using WP_Query() and the category has 10 posts for example, I seem to be missing a post. So querying for 10 posts only returns 9, querying for 11 posts only returns 10 and so on. Does anyone know why I am always missing one post in my query res...
It sounds like you have a filter running on that page that's adding an <code> offset </code> parameter to your WP_Query. There aren't any really easy ways to search for all filters. The plugin Hikari Hooks is the simplest that I've seen. If you install and activate that plugin and view the problem page, you should be a...
Why always one post missing
wordpress
I am using the following code and everything in the user profile is updating except the user's email. In the template: <code> global $current_user, $wp_roles; get_currentuserinfo(); /* Load the registration file. */ require_once( ABSPATH . WPINC . '/registration.php' ); /* If profile was saved, update profile. */ if ( ...
You need to use <code> wp_update_user() </code> for the email, as it is not user-meta but core user data. The code should look something like this: <code> $args = array( 'ID' =&gt; $current_user-&gt;id, 'user_email' =&gt; esc_attr( $_POST['user_email'] ) ); wp_update_user( $args ); </code> Note: that's untested, but it...
How do you update user_email on the front end in WP 3.3?
wordpress
Can anyone explain how to interpret and make sense of the active_plugins option_value string in WordPress. And then use this string/ array to disable and activate specific plugins? Here is an example: <code> a:8:{i:0;s:21:"adrotate/adrotate.php";i:1;s:19:"akismet/akismet.php";i:2;s:33:"better-related/better-related.php...
That's a serialized array. <code> // Serialized: a:8:{i:0;s:21:"adrotate/adrotate.php";i:1;s:19:"akismet/akismet.php";i:2;s:33:"better-related/better-related.php";i:3;s:17:"clicky/clicky.php";i:4;s:49:"custom-post-permalinks/custom-post-permalinks.php";i:5;s:32:"disqus-comment-system/disqus.php";i:6;s:33:"export-to-tex...
How to make sense of the active_plugins option_value to enable and disable certain plugins from the database?
wordpress
The WordPress codex on wp_get_attachment_link says you can use the $permalink parameter to link to the page, not the image. But I would like to link to the post instead. I'm trying to get a list of images using the following (updated, see answers below): <code> &lt;?php $new_query = new WP_Query('&amp;showposts=1'); ?&...
Yes, if you pass third ( <code> $permalink </code> ) parameter as true in <code> wp_get_attachment_link() </code> image will link to attachment's page not image itself. You can use <code> wp_get_attachment_link </code> filter to change behavior of that parameter, but in this case it simply means overwriting whole funct...
Getting attachment post using wp_get_attachment_link
wordpress
Is it possible to include index pagination on a static front page? I have a child theme of twenty eleven and I am attempting to have a home page where there is a slider for sticky posts followed by the recent posts with a custom query, that I would like to be paginated. I created a page template, and set that page temp...
Create a file <code> front-page.php </code> as a copy your <code> index.php </code> . Add the slider code on top of the page. WordPress will now take care of the pagination for you. If you need the slider on the first page only wrap it into a conditional: <code> // First page if ( empty ( $GLOBALS['paged'] ) or 1 == $G...
Static front page with recent posts pagination
wordpress
I want to call wp_mail() from a non-template php file, but when I do so it fails and I don't understand why. For example, let's say I have a php file that consists of only this: <code> &lt;?php echo 'hi'; $mail_sent = wp_mail('example@example.com', 'subject', 'message'); echo $mail_sent; ?&gt; </code> If I load that ph...
The standalone script will not load WordPress, so it doesn't have a <code> wp_mail() </code> function. WordPress has its own built-in Ajax handlers which you can leverage and have access to all WordPress functionality within those Ajax calls.
Need clarification on how to correctly call wp_mail()
wordpress
I need to know the most efficient method to grab 3 pieces of data from from multiple posts: Post title Thumbnail Custom Field I am attempting to build a Google map of posts using data stored in WP posts. Each post has geo coordinates and a thumbnail. I want to pull the title, geo custom field and thumbnail and use this...
Sorry! Turns out the problem with query_posts failing here was due to my PHP memory_limit. I changed it from 8mb to 128mb and the problem goes away.
How to grab data (titles, thumbnails and custom fields) from multiple posts to populate a new array efficiently?
wordpress
I am creating a WordPress network and am looking for a way to pull recent images from the sub blogs, but I am having some trouble doing so. What is the easiest way to make this happen?
Use <code> switch_to_blog </code> to switch blog contexts to a specific blog ID. From there on it's all down to <code> get_posts </code> of the <code> attachment </code> type. And switching back to the current context with <code> restore_current_blog </code> . Something like this: <code> switch_to_blog( $blog_id ); $ar...
Multisite Pull Recent Image Attachments from Blog ID
wordpress
found close stuff but none that exactly answers my question.. so.. How do i get the only the first taxomony (category) of a custom post type... i can get all - no problem.. this what i am using to grab all of them <code> &lt;?php foreach ($terms as $term) {echo '&lt;a href="'.get_term_link($term-&gt;slug, 'sitecat').'"...
I'm not sure what you mean by 'first' taxonomy... but, <code> $terms = get_the_terms( $post-&gt;ID, 'mytaxonomy' ); </code> returns an array of taxonomy term objects, so <code> $term = array_pop($terms); </code> Would give you the first term in the array. And then: <code> echo '&lt;a href="'.get_term_link($term-&gt;slu...
Get the first Category / Term only in single-custom-post.php
wordpress
http://webdesignsalemoregon.com/westernmennoniteschool/ is my website. I've got the top menu which is the one that was in the theme when I started to customize it. It's got a test drop down that works just fine. I included a secondary menu under the slider with this code <code> &lt;div id="secondaryMenu"&gt; &lt;?php $...
First let me start by stating the @cale_b is probebaly right and you should first look at your css / jquery to ensure that your items arnt being hidden... Also - you should change this: <code> 'depth' =&gt; '2' </code> To this: <code> 'depth' =&gt; 0 </code> 0 = show all &amp; no need to surround it like this: '0' This...
How do I get my nav menu to show sub pages?
wordpress
I have a specific wordpress registration page where I have a new user complete their registration form. However, if someone clicks on the "forgot password" link in the login section of my site and then clicks on register, they'll be able to register for the site without going through the normal registation form. How ca...
Hook into <code> login_form_register </code> and throw people to your registration page with <code> wp_redirect </code> . <code> &lt;?php add_action( 'login_form_register', 'wpse45134_catch_register' ); /** * Redirects visitors to `wp-login.php?action=register` to * `site.com/register` */ function wpse45134_catch_regis...
How to redirect action=register link on the lostpassword page to a different link?
wordpress
I got strange problem and im stuck. I have custom post type with around 15 custom fields. I moved data from old db (not wp) by using <code> wp_insert_post </code> , <code> update_post_meta </code> and <code> wp_set_object_terms </code> . All went good. All vcards works fine. I got 3500 vcards and now when i try to sear...
You got a <code> preg_match_all() </code> , various <code> JOIN </code> s, <code> anonymous/lambda function </code> s. In short: Everything that makes debugging hard and is performance wise a no-go. In short: You should use a <code> meta_query </code> instead. Take a look at Code <code> meta_query </code> » Multiple Cu...
Search through custom post type and custom fields takes 5 minutes
wordpress
Hoping someone can help. I'm trying to update a friends website - the original developer has gone AWOL unfortunately and left me to pick up the pieces. On the front end of the site the developer has installed Magpierss to have a twitter feed scroll along the bottom. However we've just noticed that in the blog section (...
My advice would be to scrap that. Fetching RSS feeds is part of WordPress functionality. In the past it used Magpie (so no sense whatsoever in adding another copy) but it is long deprecated and currently SimplePie is used. What this means in practice that there is <code> fetch_feed() </code> WordPress function that wil...
Help with Magpierss and Wordpress
wordpress
How can I have some taxonomies to always have "the most used tags" displayed when a new post is being created. Thanks.
There does not appear to be any way to hook into that from inside PHP http://core.trac.wordpress.org/browser/tags/3.3.1/wp-admin/includes/meta-boxes.php#L300 So JavaScript will probably best suit as a quick and easy solution. <code> add_action( 'admin_footer-post-new.php', 'wpse_45149_inject_script' ); function wpse_45...
How to have "the most used tags" taxonomy always expanded?
wordpress
I'm trying to get first the content of a single page (the one that is queried), and then in a small section below i want to display the title of my bloggposts as a "Latest News" section. The problem is that if i first use <code> &lt;?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?&gt; </code> to get the ...
Change: <code> foreach ($posts_array as $monster_news) { setup_postdata($monster_news); </code> To: <code> foreach ($posts_array as $post) { setup_postdata($post); </code> It seems <code> setup_postdata() </code> actually doesn't modify <code> $post </code> itself (which was news to me). PS also loose empty <code> , </...
Both a page loop and posts loop on the same page
wordpress
I am updating a diabetes forum to make it more extensive for which I have previously used phpBB 3. I have decided to use WordPress on the new build and have installed bbPress, however, I would like to import/transfer the existing users, forums and posts on phpBB into bbPress. There aren't that many of each to do manual...
Never mind now. Fortunately (in this case) I have found an alternative solution to bbPress for WordPress - Simple:Press! I personally think that Simple:Press is much better not only because it allowed me to import everything from phpBB very easily but also because it seems much more comprehensive and well put together;...
phpBB 3 to bbPress
wordpress
I was wondering what processes exactly use the <code> cache </code> directory inside my theme's directory. More specifically, I am wondering if I should add any of those files to my git repo.
If you use someway "compilable" WordPress theme (are they exist?!) cache-dir may contain theme-files, processed by some tools and prepared for using by httpd-server of site. As all and any artifacts, constructed from versioned data , these files can and have be excluded from versioning - everybody will be able to rebui...
what is the cache directory for in my theme? (version control it?)
wordpress
I wrote a plugin to send an invitation to a friend and am submitting a form using AJAX and used the tips talked about in 5 tips for using AJAX in wordpress and another article referenced in the AJAX in plugins wordpress codex page. I have now got the relevant code executing and sending an email as expected however the ...
I solved this by using ajaxForm instead which does not suffer from any reload problems. Moreover, it is also included with a wordpress as an available plugin so its well integrated.
Page reload occurs before request finishes
wordpress
What I would like to know is if it is possible to disable the edit post function in wordpress based on User's roles. I try to explain better. Let's take an 'Editor' as role example: I would like Editors, Authors.... but NOT ADMIN to be able to write posts only using Custom Fields instead of the 'classic' built in edit ...
You can remove post type support for the editor on a conditional basis. The following should work: <code> add_action( 'add_meta_boxes', 'wpse45113_remove_editor' ); function wpse45113_remove_editor() { // change the capability and post type to whatever is appropriate if ( ! current_user_can( 'install_plugins' ) ) remov...
How to disable Edit Post and Allow only Custom Field?
wordpress
When I go to configure widgets in Twenty Eleven theme, there are 5 "sidebars" available: Main sidebar Showcase sidebar 1st col of footer 2nd col of footer 3rd col of footer In a child theme, I'd like to support sidebar on posts which is quite easy using these instructions but at the same time, main sidebar on the homep...
I think I understand what looking for. I've put together some code I've taken from parts of my themes to give you an example. For the functions.php: <code> &lt;?php add_action( 'after_setup_theme', 'ideatree_init' ); if ( ! function_exists( 'ideatree_init' ) ): function ideatree_init() { // REGISTER THE NAV MENUS (3 in...
How to create my own sidebar in Twenty Eleven child theme?
wordpress
I am loading <code> upload-media.php </code> file using <code> thickbox </code> on front end where user can upload images to the post. Question: How to I trigger the <code> upload-media.php </code> so the link "set featured image" shows up on image manager, just like we see when we click on "set featured image" link on...
To get the <code> "Use as featured Image" </code> link you have to pass <code> post_id </code> to the <code> media-upload.php </code> file with the url so the request will be changed to: <code> var post_id = 234 // retrive the post id via php var request = url.media_upload+'?post_id='+post_id+'type=image&amp;amp;TB_ifr...
Image uploader with "Set Featured Image" link on front end
wordpress
I'm using different headers for in my wordpress/buddypress setup and I need a conditional statement for member pages. So everything that comes after mysite.com/members/. How do I do that with something like is_page()?
Try this function <code> bp_is_members_component() </code> .
conditional statement for profile pages
wordpress
Building my own contact form in Wordpress. Any there any security steps I need to consider other than the typical email etc validation and maybe a captcha. I am not sending any data to the database.
You should use a nonce to protect yourself from CSRF attacks . Even though you're not sending anything to the database, I'd suggest using some of the built in data validation functions (there is even a <code> is_email </code> function for you to use!) to strip out any HTML from your email. <code> esc_html( striptags( $...
Contact Form Security
wordpress
I am looking for a Engadget like featured breaking plugin. I have searched myself but did not found any relevant results. I would be very thankful for the help. EDIT: Here is a visual image of how it should look like. Thanks in advance.
You can get a plugin that does this here: http://premium.wpmudev.org/project/recent-posts Called recent posts, you can add the widget and change the Title to 'Featured Breaking'
Engadget Like Featured Breaking Plugin
wordpress
I have a Custom Post Type called <code> species </code> - fishkeeping species profiles. Each species profile can have as many media attachments as it needs, plus a separate <code> featured image </code> . I've dealt with this by storing it in the <code> postmeta </code> table under the key <code> attached_media </code>...
I never had much luck with that AJAX plugin either, but ViperBond's Regenerate Thumbnails works perfectly for me on a number of sites: viper007bond.com/wordpress-plugins/regenerate-thumbnails It manages several thousand images on my server, albeit somewhat slowly, although you can also run it on individual images or ba...
Resizing thumbnails retrospectively
wordpress
reading the quicktags.dev.js i see in the comments <code> * Run quicktags(settings) to initialize it, where settings is an object containing up to 3 properties: * settings = { * id : 'my_id', the HTML ID of the textarea, required * buttons: '' Comma separated list of the names of the default buttons to show. Optional. ...
I have stumbled into this very same issue, and got the quicktags to work. Here's the code to add to functions.php: <code> &lt;?php add_action('admin_print_footer_scripts','my_admin_print_footer_scripts'); function my_admin_print_footer_scripts() { ?&gt; &lt;script type="text/javascript"&gt;/* &lt;![CDATA[ */ var id = "...
Use quicktags toolbar on any textarea
wordpress
It's not a question that can be answer wit a single BEST answer, but i like to know wich framework outthere could solve most of de problem of creating a site from PSD to html. What i am looking to is. HTML5, CSS3, jQuery, SEO build in, Drag and drop interface, Font replacement (cufont), microformat, responsive, mobile ...
As far as I am aware and based on interpretation of your heavily indecipherable question (no disrespect intended) you are asking for a plugin or framework that you can install in Wordpress that will allow you to visually convert a PSD into a Wordpress theme. As far as I know there isn't such a thing in any form of Word...
Wordpress framework
wordpress
For security in the production environment a company I work with has removed the whole <code> wp-admin/ </code> directory, and is about to disallow all <code> *.php </code> file calls with a <code> 403 Forbidden </code> HTTP error. Are there any pitfalls to doing this? (Other than the obvious thing of now allowing admi...
My understanding: They are going to disallow *.php access from external HTTP requests. It should not cause a problem. It's a common security measure to disallow extension access, and if you are using custom permalink structures, you can get around most of the needs to do so. Since quite a bit of your interactions with ...
Side effects of disallowing *.php requests in production environment?
wordpress
I've never used the Transients API before and was wondering if anyone has guidance on when to use it. The Codex article implies that as a theme developer I might want to set each new <code> WP_Query() </code> as a transient; I assume the same might be said for direct $wpdb queries and <code> query_posts() </code> . Is ...
Transients are great when you're doing complex queries in your themes and plugins. I tend to use transients for things like menus and showing other things like Tweets from Twitter in a sidebar for example. I wouldn't use them for absolutely everything more-so just temporary pieces of data that can be cached. Keep in mi...
When should I be using the Transients API?
wordpress
I'm trying to assign a special template only to buddypress pages (activity, members, profile...). All other posts / pages use a different template. Problem is: I just can't find a good way to tell if a page is "rendered" by buddypress or by the wp "core". I've looked in the bp codex and found the template tag bp_is_mem...
<code> bp_current_component() </code> does not necessarily return a boolean - it returns <code> false </code> if not in a BP component, but will return the name of the component otherwise, as a string. Internally, BP uses the function <code> bp_is_blog_page() </code> to do what you're asking - if it returns true, it's ...
Conditional template tag for buddypress pages
wordpress
I have the exact same files (except for wp-config) running on a local server and a test server, and in my functions.php I have this: <code> function len_scripts() { if (!is_admin()): wp_enqueue_script('jquery'); wp_enqueue_script('thickbox'); endif; } add_action('wp_print_scripts', 'len_scripts'); </code> On my localho...
Reposting comment as answer: I came to find out that the theme was never calling <code> wp_footer(); </code> which was stupid of me not to check since i didn't write the whole theme. Thickbox always goes on the footer.
thickbox never gets called (weird behavior)
wordpress
Not quite sure why this is happening, hopefully someone can help. I have a wordpress installation, lets say for arguments sake it's installed to http://www.example.com/wordpress . I have a file called test.php with the following code: <code> &lt;?php include '/php_path_to_blog/wp-blog-header.php'; echo get_current_user...
Very similar to this question of a couple of hours ago: stackexchange-url ("How can I get a list of latest posts outside of my WP install?") Use <code> chdir() </code> to move into WordPress root before including and even calling anything related to WordPress. The are cases where relative directory and file references ...
Get user info outside Wordpress
wordpress
All In my application there is notification system, when user click on that icon I want to make ajax call. The problem id it works fine for admin user (Debug : 200 ok), but not for subscriber user (Debug : 301 moved permanently). Ajax call <code> $("#notifications-button").click(function() { $.ajax({ type : 'POST', url...
The problem is a conflict with the plug-in Role Scoper . Deactivating the plug-in resolves the issue. As an alternative to Role Scoper, (I do not offer this as a recommendation , simply a suggestion), there is the plug-in Members .
Ajax call in wordpress not working for subscriber user
wordpress
i tried this shortcode: [gallery class="fancybox" link="file" columns="5"] But the class="fancybox" isn't been added to the a href tag of each image. How can i add class="fancybox" to each a href tag?? ps: where is the source code of gallery?
You can use javascript/jquery to solve this. When you insert a gallery in a wordpress posts, the whole gallery is wrapped by a div with id like "gallery-1" but also a class that's always "gallery". Also, every item is surrounded by two other "dl" and "dt", with class "gallery-item" and "gallery-icon" respectively. So, ...
How do i add class="fancybox" to the default gallery?
wordpress
I have a post thumbnail set for standard posts (when an image is featured) but for image format posts I'd like to have a separate, dynamically resizing (i.e. image resizing in the functions php via add_image_size), thumbnail. I found this snippet from the codex: <code> if ( has_post_format( 'video' )) { echo 'this is t...
From your comment: This is all I meant: <code> add_image_size( 'index-thumb', 640, 250, true ); add_image_size( 'image-format', 630, 9999, true ); </code> So, let's assume you create custom image sizes for <code> gallery </code> and <code> video </code> (as well as a "default" size, which we'll call <code> standard </c...
Specific Post Format Image Thumbnail
wordpress
Is there a way to disable single post page, for example when some tries to go to single post page to show 404 page.
Although I'm also curious as to why you'd want to do this, and would probably suggest using a custom post type instead, this would probably work (actually works for any single post type except pages and attachments): <code> add_action( 'pre_get_posts', 'wpse44983_single_post_404' ); function wpse44983_single_post_404( ...
Disable single post page
wordpress
The image on the left is what it is currently looking like. I used developer tools to change the width &amp; height of all the image fields for the image on the right, however I would like some sort of cropping to get a similar effect without the scaling issues. My code is below. <code> &lt;div class="thumb"&gt; &lt;?p...
I've approached this problem in a few different ways, here's some ideas: Just grad the medium sized thumbnail with <code> the_post_thumbnail('medium'); </code> (or any defined size that is bigger than what you want displayed), and apply a <code> .inner .thumb img {width: 153px; height: auto;} </code> css rule. If it's ...
Featured Image Thumbnail Sizing
wordpress
What is the exact difference between <code> esc_html </code> and <code> wp_filter_nohtml_kses </code> . Everywhere I look says that both strip all the html, the only difference I can see is to do with exactly how they do this. Does <code> esc_html </code> encode the tags and does <code> wp_filter_nohtml_kses </code> st...
Contrary to what you have been looking at, <code> esc_html </code> does not strip all the HTML, it escapes it, meaning it encodes it into safe HTML entities that do not break HTML tags. <code> wp_filter_nohtml_kses </code> strips all the HTML. When in doubt always consult the source code. It is accessible online. <code...
What is the difference between esc_html and wp_filter_nohtml_kses?
wordpress