question stringlengths 0 34.8k | answer stringlengths 0 28.3k | title stringlengths 7 150 | forum_tag stringclasses 12
values |
|---|---|---|---|
I'm looking for a solution to a bug that occured in an answer to stackexchange-url ("an earlier question"). The general idea is that I want to invoke submit on the post form and have the page published. What happens now is that the page reloads and the message "Page updated" appears, however the page is not published a... | Trigger the <code> click </code> event of the publish button instead, and let WP do the work. <code> <script> jQuery(document).ready(function( $ ) { $( "#secondary-publish" ).click(function () { $( "#publish" ).click() }); }); </script> </code> Don't use <code> language </code> (it was deprecated in HTML 4.... | Publish page by invoking submit via jQuery | wordpress |
I'm just getting started with wordpress development. I'm trying to create a simple plugin that show results from a db in a table. I can do this, but I'm having trouble with the plugin showing at the top of the admin pages. I'm not sure why it does this. my plugin function: <code> add_action('init','hello_world'); funct... | To complement @s_ha_dum’s answer: If you just want to offer a function to be used in a theme, make it a custom action. Sample: <code> add_action( 'call_hello_world', 'hello_world' ); </code> Now, in a theme, the author can call your function with … <code> do_action( 'call_hello_world' ); </code> … and the function will... | how to not show plugin in admin area | wordpress |
I'm creating a website for a soccer club. It has news, reports and media custom post types. There you can connect the post to the Team taxonomy. But I also need to have a page for that team where I can add info, team photo etc. Can I connect a page to a certain taxonomy? For example I got a page called "Team 1" and con... | You can register taxonomies for objects (such as posts & pages) like so: <code> add_action( 'init', 'wpse_71914_assign_page_taxonomy' ); function wpse_71914_assign_page_taxonomy() { register_taxonomy_for_object_type( 'taxonomy_name', 'page' ); } </code> | Can I connect a page to a taxonomy? | wordpress |
I'm creating a WordPress plugin that will copy posts data to a remote database, I know it will take a while to transfer all the posts. How should I create copy functionality so it won't timeout? Ideally it would run in background and show some notification on completion. | You could use WordPress' pseudo-cron and <code> wp_schedule_single_event </code> . <code> <?php // add the action. add_action('wpse71941_cron', 'wpse71941_long_running'); function wpse71941_long_running($args) { // might need to call `set_time_limit` here set_time_limit(0); // do long running stuff here // return no... | Long running action from plugin | wordpress |
I'm using a lookup table to define a few things for the qTranslate plugin Table <code> $trans_home = array('en' => 'Home','it' => 'Home','de' => 'Home','zh' => '首页','es' => 'Página de inicio','fr' => 'Page d'accueil'); $trans_company = array('en' => 'Company','it' => 'L'azienda','de' => 'Firm... | Loading it in the header should work, or on the <code> init </code> hook. You will need to declare it <code> global </code> as well. So... <code> // define global $trans_home; $trans_home = array('en' => 'Home','it' => 'Home','de' => 'Home','zh' => '首页','es' => 'Página de inicio','fr' => 'Page d'accue... | How do I define a lookup table that will work across all PHP elements of the template? | wordpress |
I have a multisite Wordpress installation with 2 blogs, on different domains. One of them works fine, but I just realized that for the other, I can't access the admin area. I can log in, but when accessing /wp-admin the request never returns and eventually times out. It was working fine the last time I tried (a few wee... | OK, I just found the problem: I had more than 5000 spam comments (most of them from an IP range I had blacklisted). Apparently it's a problem for the dashboard, although the comments page works fine... I deleted those comments directly in the DB, and everything is back to normal. Now I just need to find a way to comple... | Can't access dashboard, connection times out (other pages work fine) | wordpress |
Is there any experience with Woocommerce Grid / List view plugin, I set to automatically start the list view but the problem is that while the page is loading initially opens a grid view and instantly change to list view, it takes 1 second but it seems confusing.Is there any idea how it could be resolved? I took the co... | Undo any changes you've have made to the file, then add this at the top : <code> if ( jQuery.cookie( "gridcookie" ) != "grid" ) { jQuery.cookie( "gridcookie", "list", { path: "/" } ); } </code> Update: Sounds like a FOUC . Let's take a different approach - remove the code you added above & try adding the following ... | WooCommerce Grid / List view | wordpress |
I run a multiple author site and I have created a plugin in wp-admin where authors can connect and collaborate with each other. To enhance it, I want to display a list of latest posts, this list should look like this: As the picture shows, the list should contain the latest 10 posts with the Username, the post title li... | All you need is a table with <code> class='widefat' </code> and <code> get_posts() </code> . Then you run through the results (if there are any) and print the table rows. Here is a very simple example as a dashboard widget. Note the lack of I18n – it is not ready to use! <code> <?php /** * Plugin Name: Last posts ta... | List latest posts in WP-Admin | wordpress |
How to resolve this warning which is shown when I use the Custom Tables plugin? Can anybody help me please Warning: Invalid argument supplied for foreach() in ..\wp-content\plugins\custom-tables\pages\show_table.php on line 378 | A quick and dirty "fix" would be to change line 378 in that file and cast the <code> $qry </code> variable to an array. It should make the error go away, however, to fix the actual cause of the problem some refactoring may need to be done. You could drop the plugin author a note. <code> foreach ($qry as $row) { // beco... | Receiving error with Custom Tables plugin | wordpress |
I currently have a wordpress.org website on a server with a specific domain name. I would like to move it all to a server with another domain name as I have changed my company name. What is the best way of doing this without losing the links (Both internal links and external links going towards the site)? Many thanks i... | Here is my solution. First download this file . Then follow these steps . In shortly Backup/download your database. Upload it to your new site. Copy all wordpress folder including wp-admin,wp-content etc from your old site to new one. Edit the downloaded php file, change the password. you need to change the password in... | Moving a wordpress.org website to another domain name? | wordpress |
The organization I work for would benefit if we could take the existing WordPress installations that are located on several (~5) different servers and be able to use a universal database with the users table only. The individual servers would use a database for the remaining content. The idea is this. Have a "main" ser... | It may be possible. A lot of the core API that deals with logins and cookies is pluggable . You could replace <code> wp_set_current_user </code> with something that queried your external database rather than the internal one, for instance. Authentication is already done via a the <code> authenticate </code> filter ( <c... | Theoretical Multi-Server WordPress Setup with Shared Users | wordpress |
What would you recommend to use as far as manipulating the admin bar goes? I was thinking to just add a new admin bar node, and with CSS set a background image for the icon. Then in the node, just output the count. I have no idea how to add bubble notifications on the admin menus or admin submenus though. Any advice? | You just create the bubble (circle) with CSS, and have text site on top of it. Example CSS <code> span.mbe-update-bubble{ position: absolute !important; top: 6px !important; left: 6px !important; -webkit-border-radius: 10px !important; -khtml-border-radius: 10px !important; -moz-border-radius: 10px !important; border-r... | How to add admin bar and admin menu or submenu notification bubbles? | wordpress |
On the list tables of the administration panels, I want to change the order of the filters on top of the table. What I want: Pending Published All I tried to act on a line from the "wp-list-table" file which is by default: <code> $status_links = array_merge( array_slice( $status_links, 0, $split ), array_slice( $status... | Filter <code> views_edit-post </code> . <code> function tst($a) { // var_dump(get_defined_vars()); $tst = array(); $tst['future'] = $a['future']; $tst['publish'] = $a['publish']; $tst['all'] = $a['all']; return $tst; } add_filter('views_edit-post','tst'); </code> You can juggle that new array however you want. The only... | All, published and pending order | wordpress |
I would like to prevent users from one specific role from publishing directly their articles. Only administrators should be able to approve these. The only choice they would ever have is to put their articles as pending or draft. Any other roles may publish if they want. Is there a way to do so without any plugin and w... | The following code can go in the <code> functions.php </code> file of your theme. However, this kind of operation should not really be bound to a theme. Changing themes would allow the users with your specific role to publish again. Therefore, just put the code in simple plugin. <code> <?php /** * Plugin Name: My sp... | Pending status by default for a specific role | wordpress |
I'm extending the <code> $wpdb </code> object with properties for my custom tables. <code> function setup_wpdb() { global $wpdb; // Create properties for custom tables $wpdb->my_plugin_table1 = $wpdb->prefix.'my_plugin_table1'; $wpdb->my_plugin_table2 = $wpdb->prefix.'my_plugin_table2'; } </code> Is this a ... | As long as... You use <code> $wpdb->prefix </code> (or <code> $wpdb->base_prefix </code> ) to prefix the table Your table name is someplace public, and easily available for other plugins, themes and end users to use and extend I would say either setting the table as a property on <code> $wpdb </code> or using a c... | Where to store the name of a custom table? | wordpress |
Is it possible to use remote image as wordpress attachment? * Not stored on our server.. How about the code/script? i see that attachment is act as post in database.. seems it's possible. UPDATE what i need is to programatically attach image from remote URL and the final goal is the remote image can show as attachment ... | You'll want to get very familiar with wp_insert_attachment() , download_url() and media_handle_sideload() . It's a bit lengthy to get into the details here, but it absolutely can be done. I used these methods to create a media tab that allows a user to put in a vimeo/youtube URL which I store in a postmeta and use thei... | Wordpress Image Attachment using remote image | wordpress |
I’d like to have a page added by default when a new site is created with WP Multisite. So I have my function that creates two pages: <code> function my_default_pages() { $default_pages = array('Impress', 'Contact'); $existing_pages = get_pages(); foreach($existing_pages as $page) { $temp[] = $page->post_title; } $pa... | The hook is not the problem - your code runs in the context of the current site, not the one just created! The following code isn't tested, but it should at least highlight the problem: <code> function wpse_71863_default_pages( $blog_id ) { $default_pages = array( 'Impress', 'Contact', ); switch_to_blog( $blog_id ); if... | WP Multisite: Adding pages on blog creation by default | wordpress |
Is it possible to stop WP from creating the "Sample Page" and "Hello World!" post when creating a new blog? | Create a file <code> install.php </code> in your <code> wp-content </code> directory. In that file you declare the <code> wp_install_defaults() </code> function. If you just leave that function empty no default categories, links, posts or pages will be created. The default (pluggable) <code> wp_install_defaults() </cod... | Stop WP from creating "Sample Page" and "Hello World!" post | wordpress |
I have a lot of CPT's and custom TAXs and decided to put them into a few submenus. That worked just fine. I'll explain how I did that in a moment but the problem is that when you choose a "new term" or a "new post" the Admin's sidebar menu loses track of being within a submenu and collapses the menu. This doesn't stric... | Hmmm. I don't know what happened here. I could have sworn I'd already answered this question and closed it. In any event I used an approach based off of @brasofilo's suggestion. Basically here's all you need to do: In your PHP where you're registering the submenu use a declaration like this: <code> add_submenu_page ( L... | Nuance in adding CPT and TAX to a submenu | wordpress |
*CLARIFICATION: I'm trying to style the single post view of some categories & sub categories. The suggested solution works, but only on a page of posts from the selected categories. Eg. If a post has a category 0f 59 (or is a child category of 59) then load a stylesheet. Here's what I've tried from the Codex- <code... | Try this <code> if </code> statement instead: <code> if ( is_category() && ( is_category( 59 ) || cat_is_ancestor_of( 59, get_queried_object_id() ) ) ) </code> Update : To work for single posts: <code> if ( is_single() && $terms = get_the_category( get_queried_object_id() ) ) { foreach ( $terms as $term... | Sub-category single post styling? | wordpress |
I'm running WooCommerce and am trying to get the default product display to be sorted by the sku field in ascending order. So far I've come up with this: <code> /* Order products by SKU */ function reorder_products_by_sku( $query ) { if(is_shop() && ! is_admin() && $query->is_main_query()) { $query-&... | You might want to take a look at the WooCommerce docs, there's a good snippet there showing now to add custom sort orders. The link is http://wcdocs.woothemes.com/snippets/custom-sorting-options-ascdesc/ Once you've 'defined' your custom order you'll of course need to set it as the default in the store settings. | Trying to reorder posts by custom field | wordpress |
I bought a nav-menu with css but not sure how to use this in my wordpress theme. Is there a standard way to implement it? Like this question:stackexchange-url Documentation that came with the navmenu: is this: http://www.hicengineering.com/navmenu.html | For what I understand you want to implement a custom menu in your wordpress theme. First of all you have to understand the template structure of the theme you're using. Most themes have the navigation menu in the header.php or templates/head.php, it depends. Additionally, will you use a static menu or dynamic? Dynamic ... | Bought custom navigation menu from codecanyon, how to change feature.php? | wordpress |
Confused on how to achieve this, but what I'm trying to do is load posts with the tag "reviews" in the loop on the homepage. Index.php: <code> <?php /* Start the Loop */ ?> <?php while ( have_posts() ) : the_post(); ?> <?php get_template_part( 'content-reviews', get_post_format() ); ?> <?php endwhi... | Use the <code> pre_get_posts </code> action to modify the main query. Place this in your <code> functions.php </code> file: <code> function wpa71787_home_tag_query( $query ) { if ( $query->is_home() && $query->is_main_query() ) { $query->set( 'tag', 'reviews' ); } } add_action( 'pre_get_posts', 'wpa717... | Editing Loop So It Targets Specific Tags? | wordpress |
A client of mine reviews products on his site, and wants to display the review criteria and score on the last page of each posts. Typically, there are 3-5 pages per post, and I'm looking for a way to check if we're on the last page. ‹!--nextpage--› is used in the post to divide it into pages, and wp_link_... | You can find this info in the global vars <code> $multipage </code> , <code> $numpages </code> , and <code> $page </code> <code> global $multipage, $numpages, $page; if( $multipage && $page == $numpages ) echo 'last page'; </code> | Check if on last page of paginated post using wp_link_pages | wordpress |
I am working on creating a small web-app with wordpress as the framework. It allows you to input a customer and in turn sends an email to the customer with a link back to the website in order to complete a short survey. I have a "Customer" Custom Post Type which includes the survey questions as custom fields. I'm locki... | I think what you want is a custom rewrite rule -- specifically, a custom endpoint. This would have to live outside s2member. To start, wrap everything in a class: <code> <?php class WPSE71804 { // post type key, whatever this happens to be. const TYPE = 'customer'; // endpoint mask, 2 ^ 18 const EP = 262144; // key ... | Making a Custom Post type only visible to non-users via a specific link | wordpress |
I want to modify some general text in my personal-activity page in buddypress. Does any one know any conditional tag like <code> is_page('activity') </code> things are there for checking this? the page can be navigated as member profile page -> activity tab Thanks in advance :) Vignesh | I found the conditionals in docs :) they are like as follow, <code> bp_is_user_profile() /* will check the current page as personal profile */ bp_is_user_activity() /* will check the current page as personal activity */ </code> | How to check if the current page is a "personal activity"-page in buddypress? | wordpress |
I am using the Any Mobile Theme Switcher plugin to switch between full and mobile themes automatically. The only problem with it is that the 'switch to mobile site' and 'switch to full site' links takes you to the home page instead of the current page. The relevant bit of code seems to be this: <code> function show_the... | A quick Google search lead me to this little gem from a blog post by Konstantin Kovshenin: <code> global $wp; $current_url = add_query_arg( $wp->query_string, '', home_url( $wp->request ) ); </code> Combine that with your original code, and you have this (updated to match the WordPress coding standards): <code> f... | What can I replace '.get_bloginfo('url').' with to return the current URL rather than the home address? | wordpress |
I'm working on a system that forces users (unfamiliar with wp) to choose a category before creating a new post, and then adds some appropriate html layout styling to help them. The following code works if they choose category "x". How can it be adapted to cope with a couple of alternative category situations? Human Cod... | You should have linked to the original Q&A since the beginning... Another great code from @JanFabry, btw :) stackexchange-url ("Force category choice before creating new post?") Using exactly the code provided in his answer, this is how to make the filter <code> default_content </code> work: <code> add_filter( 'def... | Change Default Content when Creating a Post based on Previous Category Choice | wordpress |
I am adding a large number of custom post types and taxonomies so it is often visually clearer if I DO NOT have them all added to the admin menu's top level. Instead I would prefer to add them under an appropriate sub-menu. I have done that without too much effort with this two step approach: Hiding CPT using the 'show... | Have you tried <code> show_in_menu </code> instead? <code> register_post_type( 'companies', array( 'show_in_menu' => LG_ADMIN_MENU, 'show_ui' => true, '...', )); </code> | Can't create new CPTs when menu hidden | wordpress |
I'm using a couple of custom wp_query loops on my page, the first one retrieves news from a certain category then displays a small excerpt from it with the permalink. The second one is another wp_query that gets a custom post type with a few advanced custom fields. The problem is I'd like another loop within the second... | You can create any number of loops as you wish by creating more <code> WP_Query </code> objects <code> $query = new WP_Query($args); while ($query->have_posts()) : // initialization for $inner_args & backup the current global $post $inner_query = new WP_Query($inner_args); while ($inner_query->have_posts()) :... | Loop within a loop? | wordpress |
This code is from the archive page and list all products with a certain tag, can someone please help me to modify this code to make listing products only from current category: <code> <?php if ( is_product_tag() ) :?> <?php do_action('woocommerce_before_shop_loop'); ?> <ul class="products"> <?php w... | Your best bet to do this would be to add a filter/hook on the specific tag. See this snippet at the WooCommerce API docs site on excluding a category for the proper format and to get going in the right direction. http://wcdocs.woothemes.com/snippets/exclude-a-category-from-the-shop-page/ But if you want a down and dirt... | List products from current category | wordpress |
I'm doing research on custom post types for a Wordpress site I'm going to be putting together for a client of mine. The basics of the Custom Post Type seem pretty straight forward. What I'm trying to determine is the best way that I could have an image gallery as part of my custom post type. For example, a custom post ... | Custom Post Types can have image attachments like other post types. A simple way to display them is via the gallery shortcode . There are several plugins out there to enhance the gallery output, or you can also display attachments in a single post yourself via the API, for example with <code> get_posts </code> . The on... | Custom Post Type with image gallery | wordpress |
I have a gallery field using the advanced custom fields gallery addon . This is how I am outputting my gallery fields/images in my theme... <code> <?php $images = get_field('gallery'); if( $images ): ?> <div id="gallery-1"> <?php foreach( $images as $image ): ?> <img src="<?php echo $image['url'... | You can use Php's <code> usort() </code> function with a callback. For example, if you want to sort images by ID, you could try something like this (stealing the filter that @Milo used in their answer): <code> <?php function sort_callback($a,$b) { if ($a['id'] == $b['id']) { return 0; } return ($a['id'] < $b['id'... | Programatically re-order images in the ACF gallery add-on. Orderby Title, ID, etc | wordpress |
I have been tracking the slow queries log of the WP based site (with the default value of the a long_query_time set to 10), and I have noticed that the following query is often getting logged - <code> # User@Host: root[root] @ localhost [] # Query_time: 0 Lock_time: 0 Rows_sent: 394 Rows_examined: 458 SELECT option_nam... | Update : The reason the query is being logged is it doesn't use an index . The query time is 0, i.e. it actually executes fast. You can unset the "log-queries-not-using-indexes" option if you don't want these to be logged. The wp_options table has no index on autoload, so the query ends up doing a full table scan. In g... | Slow Query for the wp_options table | wordpress |
I have a custom shortcode tag with a few attributes, and I would like to be able to display its attributes on new lines - to make it more readable to content editors: <code> [component attr1 ="value1" attr2 ="value of the second one" attr3 ="another" attr4 ="value" ... attrN ="valueN"] </code> The reason behind this re... | Ok, I've never seen a shortcode done in this way so I threw together a bit of code to test your scenario. And I get the same results with code that works just fine with the standard shortcode format. Standard Shortcode Format [shortcode name1="value1" name2="value2"] I don't believe this is a result of wpautop(), but a... | wpautop() when shortcode attributes are on new lines break args array | wordpress |
Is there any way to limit the filetypes allowed for upload based on the current post type? For example, I have a custom post type called <code> documents </code> . I have a <code> File upload </code> custom field which calls the Media Uploader (media-upload.php) and I have the possibility to upload a file. I want to re... | I'm pretty sure <code> $_REQUEST['post_id'] </code> will hold the post ID you're attaching uploads to. So something like this perhaps: <code> if ( isset( $_REQUEST['post_id'] ) && $post_id = absint( $_REQUEST['post_id'] ) ) { switch ( get_post_type( $post_id ) ) { case 'document' : if ( ! in_array( $type, array... | Limit upload file type on one custom post type | wordpress |
Is it possible to add name="post_content" to more than one input field? I am using Contact Form 7 plugin, and now only the last input field with name="post_content" is gathered in the post. If I put the whole form in a div I only get raw data (not the filled one). Can someone help please. | If 2 fields have same name, web browsers ignore one of them. So you can't have the name as <code> name="post_content" </code> using contact form 7(or anything else) You can however make the name as <code> name="post_content[]" </code> which tells the browser that the field is not single & the browser won't ignore a... | post_content with Contact Form 7 | wordpress |
I know how to retrieve the rss2 feed from a category in wp, namely adding <code> /feed </code> behind the category name. However when I do this, not all entries from that feed are included in the rss, this is because I set the feed restriction to be 50 at the admin backend. I would like to know if a feed length could b... | You should be able to use <code> pre_get_posts </code> and set the <code> posts_per_page </code> to 50 conditionally (on being feed for categories). Unfortunately there is this unresolved trac ticket. The only work-around is to do hook into <code> post_limits </code> and replace the <code> LIMIT </code> part of the SQL... | Individual rss feed entry length for categories? | wordpress |
I'm creating a custom plugin which needs to display HTML with dynamically updated values. To illustrate, here's what I want to achieve: <code> <h1><?php print $title; ?></h1> <h3><?php print $subtitle; ?></h3> <div class="description"><?php print $content; ?></div> ... | The various styles of mixing and matching HTML and PHP has always been a bear. Circumstances sometimes dictate the method you use, but many developers prefer one style or another and WordPress tends to use the style in your example. Another option, which is a bit cleaner in my opinion is to make use of the heredoc synt... | WordPress templating system for custom plugins | wordpress |
I have disabled comments in my wordpress site. So comments/feed url is giving 404 error. So how should I resolve these errors? doaminname/feed works fine. But domainname/comments/feed is giving error. So I want to fix that error. | I added <code> remove_action( 'wp_head', 'feed_links', 2 ); </code> in functions.php file. and added in the header.php. This fulfilled my purpose. | How to resolve 404 errors for wordpress comments/feed when I have disabled comments | wordpress |
I run a multiple author platform where I have added conditions that force authors to add tags to their post. To improve SEO, I would like to add Meta Tags to the posts. Ideally, with a light solution (have high traffic) through functions or custom plugin. There are two meta tags that I want to add, first one is descrip... | I would keep out of your <code> header.php </code> & either add the following to your <code> functions.php </code> or wrap up as a plugin: <code> add_action( 'wp_head', 'wpse_71766_seo' ); /** * Add meta description & keywords for single posts. */ function wpse_71766_seo() { if ( is_single() && $post_id... | Adding Meta Tags to a Post using its Tags, Excerpt and content | wordpress |
I have few thousands posts and need to list all of them in the admin. When I used WP_Query to get them all at once I got a memory error. Then I split it into several query calls and it worked just fine with 256 MB limit. Here is the code: <code> $limit = 200; $offset = 0; while (TRUE) { $posts = new WP_Query(array( 'po... | The posts are still held in memory under WordPress' cache mechanism (even though you replace <code> $posts </code> on every loop) - delete each one after operating on it: <code> # do some echoing with the $post # wipe post from memory wp_cache_delete( $post->ID, 'posts' ); wp_cache_delete( $post->ID, 'post_meta' ... | loop through all posts memory error | wordpress |
I wish to set a featured/header image for each of my category archive pages, how would I go about doing this without hard coding each category into the theme? An example of the page is at http://keswickscouts.org/section/cubs The code form header.php is <code> <div id="main-image"> <?php // Check to see if the... | What I did was; using the Taxonomy Images plugin to associate an image with each category, then to my theme's header.php, below the <code> <a> </code> line in the above code; <code> <?php $image_id = apply_filters( 'taxonomy-images-queried-term-image-id', 0 ); if ( is_category() && ! empty( $image_id )... | Category index featured image | wordpress |
The goal : Completely remove the ability to access the WordPress backend on the production domain. Ex. return a 404 for http://example.com/wp-admin Purpose : I don't want any possibility of WordPress' backend being accessed across the Internet. Instead, it will only be accessibly via VPN on an internal domain (i.e. htt... | If you know the sub-net of your VPN you could restrict access to /wp-admin via .htaccess using standard Apache rules. <code> <Directory /var/www/wp-admin/> Order deny,allow Allow from 192.168.1.0/24 Allow from 127 </Directory> </code> Obviously you'd need to adjust the directory and IP address subnet to sui... | What is the best method to close off the backend? | wordpress |
I am using this code to reorder the positions of the menu items for BuddyPress profile. I am using the xprofile (not sure if that makes a difference). Here is the code that I am trying to use: <code> <?php /* Plugin name: BP custom Plugin URI: http://pittbullweb.com Description: Customs for Buddy Press Version: 0.1 ... | It looks like you have the function both in bp-custom.php and in your plugin. You don't need a plugin. Put your code in plugins/bp-custom.php only. Or in your-theme/functions.php | Reordering Buddy Press profile navigation | wordpress |
I have a password-protected page, for whom I'd like to use a custom template to query posts from a specific category. How can I achieve that query_posts should work only after users submit the password of the page? I'm trying with this but doesn't work (page only displays header and footer) <code> <?php /* Template ... | separate the queries for the current page and the query for all posts in a category. Untested example: <code> <?php /* Template Name: xxxx */ ?> <?php while ( have_posts() ) : the_post(); ?> <?php get_header(); ?> <?php if ( post_password_required() ) : $args = array( 'cat' => 9, 'numberposts' =... | Custom template for password protected page | wordpress |
I have this shortcode structure: <code> [component] [type1]some content[/type1] [type2]some more content[/type2] ... [typeN]some other content[/typeN] [/component] </code> I would like to have the <code> $content </code> of the sub shortcodes stored in an array. What I am doing at the moment is, in their function, I pa... | Your data structure appears to be very list like. The reason you're running into difficulties is because you're trying to fix a fix, which is never a good thing. Instead I would suggest you seek alternative solutions to your problem. For example, instead it would be more logical to use something like: <code> <ul cla... | Iteratively add sub shortcodes to php array | wordpress |
How can I a add forward slash on categories URLs and serve only that version of a category (meaning URLs not ending in forward-slash will redirect to URLs ending in forward slash). I manage to remove the category base using the "WP No Category Base" plugin but I need to add a forward slash on the category URL. Examples... | Filter <code> category_link </code> so WordPress creates slashed URLs for categories, and <code> redirect_canonical </code> so it accepts those URLs: <code> add_filter( 'category_link', 'wpse_71666_trailingslash_cat_url' ); add_filter( 'redirect_canonical', 'wpse_71666_trailingslash_cat_url', 20, 2 ); function wpse_716... | Add forward slash on categories url (serve one version of a url) | wordpress |
I have a Wordpress Multisite installation with Buddypress. I would want to restrict people from creating another blog so that they have only one blog. How do I achieve this? | Check the user meta key <code> primary_blog </code> : <code> $user_has_blog = get_user_meta( $user_id, 'primary_blog', TRUE ); </code> For users without a blog <code> $user_has_blog </code> will be false now. For other users <code> $user_has_blog </code> is the blog ID. | How do I know if a user has a blog in Wordpress Multisite? | wordpress |
I did a custom user profile page for wordpress that lets you update your profile including uploading your custom avatar and save that photo to the Media Library. Is there a way for the a specific avatar to be deleted using it's attachment ID? | Use wp_delete_attachment <code> <?php wp_delete_attachment( $attachment_id ); ?> </code> | Is there a way to delete images from the Media Library programatically? | wordpress |
I am building a section on a site where I am merging two different post types into one loop, and then displaying them randomly. The problem is, I'm having a hard time finding a way to limit the amount of posts per type. Here's what I've tried: One query with multiple post types can be achieved with an array: <code> $ar... | One way is to customize the SQL query executed using <code> posts_clauses </code> or other such filters. To find them search for <code> posts_clauses </code> in "wp-includes/query.php" & see the series of filters just before this line. These together are capable of customizing any part of the query Another thing yo... | Combining queries with different arguments per post type | wordpress |
I'm currently working on this website and a test shows that the search page isn't working properly. Every time someone searches for something, it comes up blank. The code for the search page is as shown below. Search Form: <code> <form role="search" method="get" id="searchform" action="/search/" > <div><... | Change <code> action="/search/" </code> to <code> action="<?php bloginfo( 'url' ) ?>" </code> | Search Page Returns Nothing | wordpress |
I see that your can sort media by a numbered order in the media gallery for a post. But what table is this order stored in? I want to use this order to also order the images the same way in my posts. | This is the <code> menu_order </code> . You can sort by multiple values too. <code> // Example 'orderby' => 'title menu_order' </code> | What table is the media's sort order stored? | wordpress |
I have currently updated a site and made many improvements to it. The old site ran off 3 different systems and had wordpress (and the other systems) in the webroot. I have moved wordpress into a subdirectory (wordpress) and I also updated my blog posts to be prefixed with blog/. Pages and the front page are not prefixe... | If you intend to do checks based on template tags you should hook on <code> wp </code> action. <code> template_redirect </code> will suffice too, but <code> wp </code> is earlier. This is when WP handles 404 itself. To perform a 301 redirect use <code> status_header( 301 ); </code> , <code> wp_safe_redirect(); </code> ... | 404 to 301 - Fixing old links | wordpress |
I need to migrate an existing website to WordPress. This website already has a basic database containing users and posts (with a category), but it also has a high number of records so it's not possible to do it manually. What is the best way to import them into my WordPress database? Should I try to export the old one ... | Unless there is a core Wordpress import filter available for your CMS ( see http://codex.wordpress.org/Importing_Content ) or a plugin for a CMS not covered by core WP ( see http://wordpress.org/extend/plugins/search.php?q=import ), or a Google search for your database schema doesn't reveal anything, you need to roll y... | Best way to import users, post and categories from an external database | wordpress |
I can create pages in wordpress very simple like <code> www.mysite.com/profile </code> Now I have a question how can I make more pages in this page like <code> www.mysite.com/profile/edit </code> or maybe more pages like <code> www.mysite.com/profile/edit/image </code> Thanks in advance | In case, if you are asking about nesting of pages, then you do the following - Create the edit page, and make the profile page the parent of the same (you can see this take effect when you update the page and the url changes to www.mysite.com/profile/edit) Similarly, create the image page, and make the edit page the pa... | advanced paging in wordpress | wordpress |
I have a custom post type called "my_people" along with a custom taxonomy named my_people_categories. It is used to display a list of people. I would like to show only the people in the list that are in a specific category in the custom taxonomy. I have tried using the following short code, but it displays all the peop... | according to the list of supported parameters you can possibly use it with a custom post type by setting <code> post_type </code> to <code> any </code> , but it doesn't appear to support custom taxonomies. | How to display a category from a specific post-type | wordpress |
In pure HTML, I'm used to storing the files relative to where the particular HTML file is, such as <code> css/style.css </code> . However, with the theme I'm using with Wordpress, "Responsive" I don't know where the images are to be stored. Can you even use relative linking with wordpress? | Let me answer your question with a question: Are these images part of your template or for general purpose? The Wordpress theme " Responsive " has images files all over its theme folder. The theme should be at <code> yoursite.com/wp-content/themes/responsive </code> . In that theme folder there are a few folders with i... | With Wordpress themes, where do I store the images and files relatively? | wordpress |
I have written a plugin that (besides other functionality) makes posts from existing content. For each post I have one picture - how to make them featured programmatically ? I do the: <code> $id = wp_insert_post( $my_post ); wp_set_object_terms( $id, $cat_ids, 'category' ); </code> and I would like my next step to be i... | Try using <code> set_post_thumbnail() </code> . Assuming you already know how to determine the <code> $post </code> (ID or object) for which to set the featured image, and the <code> $thumbnail_id </code> (ID) of the image that you want to set as the featured image: <code> set_post_thumbnail( $post, $thumbnail_id ); </... | How to add/assign or change featured image in post programmatically? | wordpress |
I have a menu generated by <code> wp_nav_menu </code> which look like <code> <ul class="nav-menu" id="menu-top-nav"> <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-43" id="menu-item-43"><a href="http://www.example.com/item1.com">Item 1</a></li> <li class="m... | You can modify your menu by using walker. <code> include('subMenu.php'); $menu = wp_nav_menu( array('menu' => 'YOUR-MENU-NAME','menu_class' => 'megamenu','walker' => new subMenu)); </code> create a file subMenu.php in theme folder add below code. <code> <?php class subMenu extends Walker_Nav_Menu { function... | How to add sub-menu to a menu generated by wp_nav_menu by using plugin | wordpress |
I have a loop set up to display projects with two types of taxonomies attached to each. My issue is that within the loop I have set up a function to select specific posts to attach different imagery/styling to them and for some reason these posts are printing every taxonomy, not just the taxonomies specifically related... | You are a victim of WordPress’ great naming scheme. You don’t need <code> get_terms() </code> , but <code> get_the_terms() </code> . Note the <code> the </code> ? That makes a huge difference. <code> get_terms( $taxonomies, $args = '' ) </code> : Retrieve the terms in a given taxonomy or list of taxonomies. All terms. ... | Posts in loop displaying all taxonomies | wordpress |
I have built a series of pages and sub pages in wordpress. Then, using custom menus with 5 x top level menus and then sub-menus under 3 of these top level menus: <code> Menu 1 Menu 2 - Sub Menu 1 - Sub Menu 2 Menu 3 Menu 4 - Sub Menu 1 - Sub Menu 2 - Sub Menu 3 - Sub Menu 4 Menu 5 - Sub Menu 1 - Sub Menu 2 </code> When... | I figured it out. The menu name was "Search" so wordpress redirected the subpages to the wordpress search results page and was assuming the search functionality. | Custom menu linking to page not found | wordpress |
http://wordpress.org/extend/plugins/wp-firephp/ I'm simply supposed to call <code> fb('Error message','Lable') </code> but it doesn't work all the time. I can't figure out when and where the relevant files are being included and classes defined in order to make the call to the said method/function. For example it doesn... | I gave up on using the plugin and use FirePHP straight as a <code> mu-plugin </code> : And <code> firebug.php </code> file consists of: <code> <?php /* Plugin Name: FirePHP Version: 0.1 */ require_once( 'FirePHPCore/FirePHP.class.php' ); ob_start(); $firephp = FirePHP::getInstance( true ); function logit( $var, $tit... | How to use WP-FirePHP extension? | wordpress |
I have the following code that lists out the children categories on a separate page when you click on its parent category. The code renders a list like so: Home › Archive for IQ Issue 7 Journal news world view However I would like to retrieve the latest post from each of these categories and print underneath the catego... | Get all children categories using <code> get_terms() </code> . Loop through each term and run a new query using <code> tax_query </code> . Example: <code> <?php if ( get_queried_object()->parent == 0 ) : // parent cat ?> <h2>Showing all children</h2> <?php $args = array( 'hide_empty' => false... | Show last post from multiple categories using wp_list_categories | wordpress |
No idea why but pagination on my homepage isn't working although it works in every other place..custom templates, archive, searches. I've tried every version of pagination possible it seems. I've used wp_query, query_posts, get_posts. I've tried the method of setting temp wp_query and wp_query to null and then adding i... | Using Milo's suggestion in the comments above fixed the issue. Using pre_get_posts we modify the loop like so. <code> function filter_main_query( $query ) { if( is_front_page() && is_main_query() ) { $query->set('meta_key', 'rating'); $query->set('meta_value', 0 ); // rest of params } } add_action('pre_ge... | Pagination working everywhere but the index page | wordpress |
I am worried about allowing more than one user of my Wordpress installation use Wordpress at the same time. What if one user updates a page or deletes a page while the other user is editing it? How robust is Wordpress under this multi-user case? I am talking about users who are logged into Wordpress as editors. | As far as writing/editing pages and posts WordPress is pretty darn good at handling multiple users and conflicts. There are clear warnings and error messages to the user that someone else is actively editing the post/page. And it will prevent you form saving changes if another user opened the post/page before you did. ... | If two users attempt to modify a page, does Wordpress still work correctly? | wordpress |
I am using Gravity Forms on my Wordpress site, and so far so good. The problem is I have made the page secure (https/SSL), and this is making the form not to work. It looks like the issue is how the site is trying to load jQuery. There are 23 JS errors on the page, which seem to be due to a failed jQuery load <code> "U... | Pretty sure it's because the official jQuery CDN doesn't support HTTPS - use Microsoft's or Google's instead. | Gravity Forms not loading under https, jQuery is not defined | wordpress |
I previously was able to change the numbers of the date and time (into a number and date system of another language, like Khmer) for each post using a script like this in my functions.php: <code> function KhmerNumDate ($text) { $text = str_replace('1', '១', $text); $text = str_replace('2', '២', $text); $text = str_repl... | Turns out it was because of the way the theme Twenty Twelve works (in their effort to make translation easy...). The date for posts in Twenty Twelve is prepared by a function in functions.php called <code> twentytwelve_entry_meta() </code> So to replace/translate the numbers in the date, I look for the line with <code>... | Change date number to another language/script? | wordpress |
I have a web site, that while working properly, every day, at 11:00am using a huge amounts of the server resources. The web hosting account contains only the WordPress, and I don't have any other software installed. Also, the hosting account is based on Cloud Linux, that means I can have statistics about my account res... | You need to check the actual access logs, such as web, SSH, etc., and if you can access it, the MySQL log, too. That will show you what is possibly hitting the site at that time and let you differentiate between a huge unexplained web traffic spike from a bot and something that is happening in Wordpress or the theme it... | WordPress performance issue. Can I debug it? | wordpress |
I have a Author page that I built using this code and it works fine. However, I have several writers that range from frequent to one-time writers. I would like to seperate out writers that have not posted an article for say 6 months. It would be nice then to output those writers in a different section like "Past Writer... | Wordpress itself does not store this info directly in database... yet you have some elegant options: you can hook into "publish post" and update list of "active users" when someone posts his/her published, you can store this information then in options table in serialized array. In this array you can have list of autho... | Author List page: Exclude based on last post date | wordpress |
I've found posts on letting Wordpress manage Magento users and vise versa, but what I'm looking to do is not to have one manage users over the other. I'd like users to have the option to sign up through the shop or through the Wordpress main site, but enable Wordpress to use the Magento users and vise versa. Should I i... | While there are a lot of different solutions for integrating allowing use of Magento Blocks in Wordpress or using Wordpress functions in Magento , what you are looking for is single login . It can be done via a WP Plugin: Mage Enabler . It's a WP plugin that gives raw access to the Mage object - you can do single login... | Integrating Magento and Wordpress Users | wordpress |
So I have a page on my site for press releases, and the press releases are a custom post type. I'm using a custom template called <code> page-press.php </code> for the Press page, and I want to display a loop of the recent posts for this post type in it. All is well there. However, when I set the <code> posts_per_page ... | Pagination is only built "well" in non-custom post-types. Below, I'll post an article with more detail about the more complex setup required for custom post-type pagination via the <code> WP_Query() </code> method. But to give the direct answer to your question, it's not working because <code> get_pagination() </code> ... | get_pagination not working on a custom post type query (using WP_Query) | wordpress |
I have a custom taxonomy dropdown ( <code> custom_authors </code> ) which is displayed in the comments form when logged in to select a different author than the logged in one. <code> add_action( 'comment_form_logged_in_after', 'taxonomy_dropdown' ); add_action( 'comment_form_after_fields', 'taxonomy_dropdown' ); functi... | <code> get_user_by() </code> receives user data not taxonomy terms. Since you are not dealing with real userdata you'll have to use <code> get_term_by() </code> to receive the term name. You would use it like this: <code> $username = get_term_by( 'id', (int) $_POST['alt_comment_user'], 'custom_authors' ); </code> Fixed... | Getting values of a custom taxonomy dropdown | wordpress |
I'm trying to get the first 10 posts based on page views through Wordpress Stats (now called Jetpack). I managed to get this code to work (approximately..) after digging for hours over the forums (because variables and code changed from time to time): <code> <?php if ( function_exists('stats_get_csv') && $to... | Check for the post type with the post ID: <code> if ( $post['post_id'] && get_post( $post['post_id'] ) && 'post' === get_post_type( $post['post_id'] ) ) </code> | stats_get_csv (Wordpress Stats) to only display top posts (not pages) | wordpress |
I'm a beginner at Wordpress, so I would appreciate it if any of you could nudge me in the right way. Anyway, what irks me is how wp_list_categories (and similar functions) produce a lot of unnecessary classes and stuff I don't need. I tried creating my own walker class based on Walker_Category, and I seem to get it wor... | Edit : After looking at the <code> wp_list_categories() </code> code I noticed that you can just pass a <code> class </code> parameter to the function. If you pass an empty string, the built-in Walker will always echo <code> class="" </code> . To get rid of the <code> class </code> attribute entirely, you will still ha... | Walker gives additional taxonomy name? | wordpress |
Ok i have a file which named, <code> page-allpost.php </code> now I have a menu item called "all post" and in that menu I want to call the page-allpost.php which will display all the post. how to do that? hope someone here could help, thanks. | Give the file a template header , then create a page under Pages in admin, and assign that template to the page. You can then add that page you created to your menu. | link a custom page into menu | wordpress |
I run a multiple author site and the content is directed to various age groups. Instead of forcing the writer to manually note which age group the post is appropriate for, I want to add a content rating system with the following labels: G — Suitable for all audiences PG — Possibly offensive, usually for audiences 13 an... | Custom field will do the task. On the post page there's nothing to do great, just create a Custom Field called agerating or age-rating. Authors will enter the value of the field according to their content with G/PG/R/X. Then at the frontend, edit single.php. Use this code inside the loop to retrieve the rating value: <... | Adding a content rating system | wordpress |
I have added a small custom function to display a little author bio blurb at the bottom of each blog entry in my functions.php file inside the current theme that I am using. So far so good, it is working great but I noticed that this function is being applied to every page, for example it is showing up at the bottom of... | Check for the type of the page: <code> function get_author_bio ($content=''){ if ( ! is_single() ) // not a blog post, stop immediately { return $content; } global $post; // continue with regular work </code> The easiest way to learn these check functions is a look at the function <code> get_body_class() </code> . Here... | Exclude custom function content from certain pages | wordpress |
This must be pretty simple, but it is eluding me. I need to add several classes to <code> post_class() </code> http://codex.wordpress.org/Function_Reference/post_class I can add one class in a page template, as below: <code> post_class($even_odd); </code> but I need to add several more, i.e. <code> $current_post </code... | Multiple post classes should be separated by a single space or should be in an array. <code> post_class("$even_odd $current_post $current_in_total"); </code> Or <code> post_class(array($even_odd, $current_post, $current_in_total)); </code> | Add $values to post_class() | wordpress |
I need to query post meta fields, filtered by a multi checkbox Currently, the query works only with second parameter (People) when the form is submitted. How can I filter with two parameters? HTML (Form submit) <code> <input type="checkbox" id="inlineCheckbox1" name="category[]" value="Planet"> <input type="ch... | You have a typo in your <code> $advtxtQuery </code> query-- <code> $where =" (( post_typs LIKE 'projects')... </code> For the rest, both queries are searching on the same key so use <code> IN </code> instead of trying to create two separate arrays, as in the Codex example below : <code> $args = array( 'post_type' =>... | meta post search | wordpress |
Is it possible to add a custom field to an existing "widget" in the backend? What I wanna do is provide a way to have a checkbox to apply a thumbnail that is double the size of the normal one on the frontend. So I'm thinking of simply adding a custom field as a checkbox that says "Double the size" and when checked I re... | Just filter <code> admin_post_thumbnail_html </code> and append your checkbox HTML: <code> add_filter( 'admin_post_thumbnail_html', 'wpse_71501_thumbnail_options' ); function wpse_71501_thumbnail_options( $html ) { return $html . <<<html <p> <label for="big_thumbnail"> <input id="big_thumbnail" ... | Adding a custom field or metabox to the post-thumbnail widget? | wordpress |
I want to get rid of the complete thickbox css js and loading gif. Can anybody give me the correct way to get rid of it all via functions.php ? Cheers, Alex | I'm guessing front end only, right? <code> function wpse71503_init() { if (!is_admin()) { wp_deregister_style('thickbox'); wp_deregister_script('thickbox'); } } add_action('init', 'wpse71503_init'); </code> | Getting RID of thickbox! | wordpress |
I'm trying to get all post except particular category this works fine but it cause the pagination button/link to render the same posts again on page 2, 3, 4 and so on not rendering the older post. Here is how I am trying to exclude a particular category <code> <?php query_posts('cat=-22');?> </code> This excludes... | I would filter <code> pre_get_posts </code> . Perhaps like so, though you may need to tweak the conditional a bit: <code> function wpse71508_filter_pre_get_posts( $query ) { if ( is_main_query() ) { if ( is_home() || is_archive() ) { $query->set( 'cat', '-22' ); } } return $query; } add_action( 'pre_get_posts', 'wps... | How to get all post except particular category without breaking the paging | wordpress |
I've developed invoicing system in WordPress for one of my website. I've used custom post type with custom meta field, integrated payment gateway to meet my needs. User generally generate invoice to upload fund. I've used a post submission from in frontend so that user can create an invoice by himself. Everything is ru... | In your Loop, whether for a 'single' page or an 'index' page, check the post author against the current user ID, and only display the post if they match. Assuming you are using a typical WordPress Loop, something like... <code> global $current_user; get_currentuserinfo(); // start of the Loop if ( have_posts() ) { whil... | Show Posts to Author Only | wordpress |
the code I'm currently using to display categories is <code> <?php foreach((get_the_category()) as $category) { echo $category->cat_name . ' ';}?> </code> I would like to exclude a category called "home-featured" or the category with ID "65" how would I add this to the code above? | You could do it like this: <code> <?php $exclude = array( 'home-featured' ); foreach( get_the_category() as $category ) { if ( ! in_array( $category->cat_name, $exclude ) echo $category->cat_name . ' '; } ?> </code> | Exclude Specific Categories? | wordpress |
Problem: I need to get an array of ID's of posts from a given category If the category have any posts. This is to be used on a plugin options page. So far I have: <code> $posts = get_posts(array('numberposts' => 10000, 'category' => 5)); </code> But I'm struggling with How do I gen an array containing just the ID... | The thing to remember about <code> get_posts </code> is that is uses a <code> WP_Query </code> object internally. <code> get_posts </code> source: <code> <?php /** * Retrieve list of latest posts or posts matching criteria. * * The defaults are as follows: * 'numberposts' - Default is 5. Total number of posts to ret... | get all posts ID from a category | wordpress |
This code show tags from a specific category such as id = 3. I want to make automatically check which category I am. Can someone please help me ? <code> $args = array('categories'=> '3'); $tags = get_category_tags($args); $content .= "<ul>"; foreach ($tags as $tag) { $content .= "<li><a href=\"$tag-&g... | within a category you can use <code> get_queried_object() </code> to get data on the current category. <code> $current_category = get_queried_object(); $args = array( 'categories' => $current_category->term_id ); $tags = get_category_tags( $args ); </code> | show category in woocommerce | wordpress |
I know there are very similar questions ans answers out there already, but I simply cannot get my query to get into the right order. I have a custom post type ("bb_articles") with custom fields, among them: - "bb_source": radio button with stored values 1, 2, 3... - "bb_date": date field I want to show posts of specifi... | It is <code> meta_key </code> not <code> meta-key </code> meaning you aren't meeting all of the conditions needed for this to work. 'meta_value_num' - Order by numeric meta value (available with Version 2.8). Also note that a 'meta_key=keyname' must also be present in the query. This value allows for numerical sorting ... | query order by date on custom type: wrong order | wordpress |
I'm trying to create a few extra theme options in the "customise" section of the wp admin menu. I would like to offer an option to load an alternative style sheet. Question: How can I adapt the following code to replace the stylesheet name "posts.css" with a user-selected option? <code> function theme_styles() { // Reg... | You're trying to execute PHP in a string - you just need: <code> get_template_directory_uri() . '/' . get_theme_mod( 'posts', 'style.css' ), </code> | How to add an alternative style sheet as a theme option? | wordpress |
I have a custom post type (that I'm using on a template page), the custom post type is called 'headerhome'. When I post say a gallery there I'm trying to get it to redirect to 'single-headerhome.php', yet it always just goes to 'single.php'. The name of the custom post type itself is arbitrary, the name of the templage... | Have you flushed your permalinks? If not, visit your permalinks page in your dashboard, then, refresh the page you are trying to view. Let us know if that helps. Edit: Upon re-reading your question, actually, no - just because you create a single-post_type.php file does not mean WordPress will use that file with regard... | Custom post type not using it's own single-postname.php | wordpress |
I have been installing lately the latest version from Thesis and getting to the point to make a custom landing Page. I have been building a plugin and I would like to link the content of it to my newly created landing Page. How do I do this, where can I upload my custom php code for the thesis landing Page? thanks in a... | You can hook from the custom.php file inside /wp-content/thesis/skin/skin-name/ Or you can use this box http://www.rickbeckman.org/the-brazenly-coded-box-for-thesis-2-0/ to write PHP codes directly inside Thesis skin editor. | Thesis 2 custom Page | wordpress |
For my post I have a box for the post image and the size of the box is 214 x 73. I want the image to fit the width of the box and have it cropped at 73px height. This is what I have so far in my functions.php file <code> <?php add_theme_support( 'post-thumbnails'); set_post_thumbnail_size(); if ( function_exists( 'a... | I don't think your code is the issue here. But there are a few caveats that you need to be aware of and account for. First off always keep in mind that when using add_image_size() that WordPress does not regenerate the images size if it was uploaded before you registered the new size. The newly registered size will onl... | Setting post thumbnail sizes in template file and functions.php | wordpress |
Basically, I want to follow the author by other WordPress users. Whenever an author posts new post subscribed users need to get notification by email. If it's not already there, I can create a plugin for this. But I need an idea to store the data. Should I go for custom table or is there a better way to store default t... | I have developed plugin called Wp Subcribe Author to subscribe author by email. You can download and use it from WordPress site. I used custom custom table structure, I feel that's good, because I don't want to mess up with database performance ! | Subscribe to author? | wordpress |
I am trying to figure out on how do I make my wordpress website to be able to add <code> portfolio </code> items from the frontend. Plugins such as WP-User-Frontend allows posting from frontend but only works with blog posts. Is there any ways or any plugins similar to wp-user-frotend but being able to add custom post ... | If you are willing to pay for it, the Gravity Forms plugin allows you to create forms that map to your Custom Post Types (even regular post and page - types) as well as map to your custom fields. For those who aren't and who are willing to roll up their sleeves then you can create a front end form that posts data into ... | Add custom post type items from frontend | wordpress |
In the site I'm trying to optimize, I noticed several queries that are rather slow and start with <code> SELECT SQL_CALC_FOUND_ROWS </code> Searching this site, the relevant question stackexchange-url ("wordpress query causing load") has no adequate answer, in my opinion. Can I somehow disable <code> SQL_CALC_FOUND_ROW... | First should only disable <code> SQL_CALC_FOUND_ROWS </code> if you aren't using pagination, to do so set parameter <code> no_found_rows </code> to <code> true </code> in WP_Query. <code> WP_Query( array( 'no_found_rows' => true ) ); </code> Note <code> get_posts() </code> does that by default. | How to disable `SQL_CALC_FOUND_ROWS` | wordpress |
So I'm learning WP and I want to create a rotating image slider for the header ( like in this ) using Theme Customization API . But I can't figure out how to and what setting should I use to take the images and store it for later animation in HTML/JS. Help? | We can do that! First, you'll need to add a custom section on the Theme Customizer, containing all the image uploads (we'll use 3 for this example): <code> add_action( 'customize_register', 'themename_customize_register' ); function themename_customize_register($wp_customize) { $wp_customize->add_section( 'slides', ... | Creating a rotating header /image slider using theme customization | wordpress |
So like wp must load series of files from, <code> index.php -> ... -> wp-header.php -> ... ->functions.php </code> ...and so on upon execution. Also there must be a similar flowchart for functions callings, conditionals and such during the execution. Is such a flowchart(s) available anywhere? | In addition to the link provided by Rohit Pande, There is also these rather in-depth explanation found at, Part 1 http://theme.fm/2011/09/wordpress-internals-how-wordpress-boots-up-2315/ Part 2 http://theme.fm/2011/09/wordpress-internals-how-wordpress-boots-up-part-2-2437/ Which also includes some diagrams/flowcharts. ... | Is there a flowchart for wordpress loading sequence? | wordpress |
Some people claim that this plugin make many read/writes to the disks making them too busy. Increasing IOps rate. Is this correct? http://wordpress.org/extend/plugins/lazy-load/ | You've provided no references to these claims people have made, and I can find no such claims on the support forum for the plugin linked to, but lets humour this theory and investigate. The bulk of the code is here in the PHP: http://plugins.svn.wordpress.org/lazy-load/trunk/lazy-load.php Judging from this I'd say that... | Does the lazyload plugin make this server disks busy? | wordpress |
When I use the following code, everything shows except the reply link! Anybody know what I've done wrong? I'd like the link to show up with the word 'Reply.' Live example: http://themeforward.com/demo2/?p=1948#commentlist In my header: <code> <?php if ( is_singular() && comments_open() && get_option(... | My suggestion would be twofold: Ensure you are properly enqueueing the <code> comment-reply </code> script Replace your hard-coded comment list with <code> wp_list_comments() </code> Enqueueing <code> comment-reply </code> I would recommend hooking into <code> comment_form_before() </code> : <code> function wpse71451_e... | Comment_Reply_Link Not Showing? | wordpress |
I'm trying to securely save custom data to database from plugin backend via ajax. JavaScript code that runs after clicking save button: <code> $.ajax({ url: ajaxVars.ajaxurl, type: 'post', data: { action : 'myPluginDataSave', someData: 'blabla', myPluginNonce : ajaxVars.nonce }, complete: function(data) { console.log('... | I don't see any <code> is_admin </code> conditional statement which is why you should include it in your snippet so we can properly assess what you are attempting to do outside of the obvious question. Either way a nonce should be mandatory. That function that receives and processes your AJAX request/response should al... | Saving custom data via ajax with nonces | wordpress |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.