question stringlengths 0 34.8k | answer stringlengths 0 28.3k | title stringlengths 7 150 | forum_tag stringclasses 12
values |
|---|---|---|---|
I have found many answers separately for Taxonomy, Custom fields and Tags, most of them outdated. But how to combine a search in: <code> - designed custom fields of a custom post - custom taxonomy terms - Tags - Title (already by default) - Content (already by default) </code> One of my custom items could be for exampl... | it seems Relevanssi is a very good updated plugin it solved my problems | search also in taxonomy, tags and custom fields | wordpress |
When adding an image attachment to a post, the Title field is always filled automatically with the file name. For some images I change this into something more meaningful, for other images I want this field to be empty (in my theme I'm displaying this title field as a caption below each image, but not all images should... | Without a post title, Attachments become significantly harder to use as they no longer have a title that can be clicked on. If you're processing attachments and generating html manually I recommend using another piece of attachment meta, or just filling in appropriate titles, after all an image is a picture of somethin... | How to allow empty title for attachments? | wordpress |
I just started learning the Wordpress Settings API and things are not as easy as I first tought.I have created a section and two fields and it seems that the fields are not saving the data.Each time I click on the field the data gets deleted.Here is my code: <code> <?php function thanathos_theme_menu(){ add_menu_pag... | Well , actually the error is pretty minor , on your callbacks you have wrote <code> function logo_field_callback(){ $option = get_option('thanathos_social_logo_options'); echo '<input type="text" id="logo" name="thanathos_social_logo_options[logo_field]" value="' . $options['logo_field'] . '" />'; } function face... | Wordpress Settings API not saving options | wordpress |
Why can't I store wp_list_categories in a variable? <code> $wplist = wp_list_categories( array ( 'taxonomy' => 'ntp_package_type', 'pad_counts'=> 0, 'title_li' => '', ) ); var_dump($wplist); //null </code> | You need to set the echo parameter to false. The function defaults to echoing the output rather than returning it. <code> $wplist = wp_list_categories( array( 'taxonomy' => 'ntp_package_type', 'pad_counts' => 0, 'title_li' => '', 'echo' => false ) ); </code> | assign the returned value of wordpress function to a variable? | wordpress |
I've got a wordpress website and i need to hide for the moment some custom post type. I want to hide it because we will need it later. How do I do it? | There is a parameter named "public" where you can set if you want the custom post type to be private or public <code> add_action( 'init', 'create_post_type' ); function create_post_type() { register_post_type( 'acme_product', array( 'labels' => array( 'name' => __( 'Products' ), 'singular_name' => __( 'Product... | How to hide a custom post type | wordpress |
I'm trying to add custom fields on post publish with this code which I added to my functions.php : <code> add_action('publish_page', 'add_custom_field_automatically'); add_action('publish_post'. 'add_custom_field_automatically'); function add_custom_field_automatically($post_ID) { global $wpdb; if(!wp_is_post_revision(... | <code> add_action('publish_post'. 'add_custom_field_automatically'); </code> You have a period in the second add_action. This should be a comma :) | How to automatically create a custom field when a post is published? | wordpress |
I have written a plugin which does some fancy stuff with GD lib when you upload an image. Everything is working fine, however I need to get the image title and add it to the image URL (and file name of the image) when the user clicks 'insert into post', but can't find any references which could help me. | You need to use the filter image_send_to_editor </code> . <code> add_filter('image_send_to_editor', 'wpse_62869_img_wrapper', 20, 8); function wpse_62869_img_wrapper( $html, $id, $caption, $title, $align, $url, $size, $alt ) { return $html; } </code> These are the values of a test insert and you can use them to build y... | Adding a querystring to an image URL when clicking 'insert into post'? | wordpress |
I am digging into a freelance career and I would like to know what the best advice is out there when it comes to buying themes for clients? What is the best practice? Themeforest? Bundles? What should be my criteria when choosing themes to develop and offer to clients? | Firstly, if you have to re-sell themes then you need to be sure that the licence permits it and that you are being open with the client, no buying a theme for $20, claiming it is your own and charging the client $1000. You should learn how themes work and look towards developing your own to become a web designer, simpl... | Advice for a Newbie Wordpress Web Designer/ Themes? | wordpress |
This is a question more geared towards those of you out there that have experience working with the popular SASS/JS Framework, Foundation by Zurb. I am trying to use it as my structural core to my new Wordpress theme and had a question... Built into Foundation are stylings for buttons, forms, and of course the famous 1... | The Foundation tabs assume that the content to display already exists in the <code> <li> </code> elements. You could go with that assumption, and just pre-load your whole website up-front, but that's probably going to cause more problems than it fixes. If nothing else, it'll take forever to load. One option (the ... | Using Zurb's Foundation Tabs as Wordpress Nav (Active Tab) | wordpress |
I'm developing a custom theme and I added some widgetized sidebars like so: <code> register_sidebars(2, array('name'=>'Foobar %d')); </code> I then recreated them so that I could give them semantic names. Like so: <code> register_sidebar(register_sidebar( array( 'name' => 'Sidebar' ) )); register_sidebar(register... | Thanks for the comment @Rarst! That was the issue. For whatever reason I had that extra sidebar method call in there and that was causing the problem. <code> register_sidebar( array( 'name' => 'Sidebar' ) ); register_sidebar( array( 'name' => 'Sub Menu' ) ); </code> WordPress saves the data from the widgets in th... | How do you Permanently Delete Sidebars | wordpress |
I have been trying to add to the default WordPress comment form. I need to add placeholder="" to each field. I can't figure out the filter. I don't get any errors but I don't see the placeholder either. After searching the posts here for an hour, I came up with this so far <code> function my_fields($args){ $commenter =... | You should filter <code> 'comment_form_default_fields' </code> to add the <code> placeholder </code> attribute. Sample code <code> add_filter( 'comment_form_default_fields', 'wpse_62742_comment_placeholders' ); /** * Change default fields, add placeholder and change type attributes. * * @param array $fields * @return a... | Add placeholder attribute to comment form fields | wordpress |
I'm trying to find a way to add multiple images to a blog post in wordpress at the same time. I want to be able to write text above and blow the images, just like a normal blog post. It takes a lot of time to add each image one at a time (especially if there are like 50 or so images in a post.) I can do a gallery, but ... | I found this plug in which lets you do just this very things. It works great! http://wordpress.org/extend/plugins/faster-image-insert/ | Is there a way to insert multiple images into a post at the same time without using a gallery? | wordpress |
To put it simply, I'm looking for users to be able to subscribe for 'X' amount a year. This would allow them to edit their own space on my site. Once they subscribe, I'd like the plug-in to create a page for the user, allowing them to edit their page, and the posts on their page only. If it helps I'm looking to create ... | Look at S2 Member http://www.s2member.com/ The s2Member® Framework is an extremely versatile & powerful (free) membership management plugin for WordPress®. The s2Member® Framework plugin integrates seamlessly with PayPal® Standard Buttons (very easy), and fully supports recurring billing, with the ability to track ... | I'm looking to add membership to my site, any plugins that would be compatible | wordpress |
I need to add a function to my theme to remove additional instances of a shortcode in a post. First off I wonder if i'm approaching this wrong, but I have a theme that is drastically reformats the way a post is laid out. In the post we look for media and shortcode and then display them at the top of the page, basically... | Add a static variable to the shortcode handler to check if the shortcode has been called already. Sample code <code> add_shortcode( 'wpse62826', 'wpse_62826_shortcode' ); function wpse_62826_shortcode() { static $done = FALSE; // Nothing to do. if ( $done ) { return; } if ( is_singular() ) { $done = TRUE; } return '<... | Function to show only first instance of shortcode | wordpress |
I'm a WordPress novice trying to help a friend (who is even more of a WordPress novice) with his WordPress blog hosted on GoDaddy. It was working fine until he apparently (he doesn't fully remember) was prompted to upgrade the software. Now the blog still works for end-users (you can see it here ) but whenever you log ... | Thanks for the other answers. Turns out GoDaddy had run an upgrade patch for WordPress which never finished. I reran the patch via GoDaddy and that fixed it! | How do I go about fixing this apparently messed up upgrade? | wordpress |
I've been modifying a long abandoned plugin project that provides a Stackoverflow inspired badge system for Wordpress. I have upgraded some of its code so it functions with the new Wordpress version. Please view the plugin code here: http://pastebin.com/kCWWLPL2 The problem is that the original code did not provide a w... | get_current_user_id(); gets the current logged in user id and you need the user whos profileUrl is views so try this insted to get the right id: <code> $author = get_user_by( 'slug', get_query_var( 'author_name' ) ); echo $author->ID;' </code> yep, so instead of your code try this: <code> $author = get_user_by( 'slu... | Improving a Stackoverflow "inspired" badge system to display badges in author page | wordpress |
When I delete a bunch of posts their custom fields remain in the database, is there a way to remove them as well on deletion? | The best way to do this is to use the wp_delete_post function as follows: <code> wp_delete_post($post_id, true); //false (default) sends it to the trash </code> This function accounts for comments, term_relationships, posts.post_parent, and postmeta. | Delete custom fields when deleting posts | wordpress |
I am trying to sort posts by their custom field value, which is a date in this format: 9 August 2012, 7:18 am <code> 'orderby' => 'meta_value', 'meta_key' => 'wprss_item_date', 'order' => 'DESC' </code> Do I need to do some conversion before that can work? | Your date should be stored in descending units, like <code> yyyy-mm-dd hh:mm:ss </code> for MySQL to be able to sort on the field. See the MySQL docs for Date, Datetime, and Timestamp data types . | Sorting posts by custom field value | wordpress |
With this code parent term page lists all the child terms and the child term page lists all of the posts in current term, and the single page lists a big flat list of terms(hierarchical). Now, The parent term page is fine. When it's child term page, i want to list all child terms( not showing with this code ) + the pos... | ok, i don't know how this looks but i've got exactly what i wanted. <code> <?php $term = get_queried_object(); $tax = 'ntp_package_type'; $parents = $term->parent; $term_id = $term->term_id; if($parents == 0 && !is_single()){ wp_list_categories( array ( 'taxonomy' => 'ntp_package_type', 'pad_counts'... | List child terms and posts in the current term | wordpress |
I was reading Wordpress documentation and also trying to find some clear example of how to do this but I couldn't, sorry if this is posted elsewhere but I did my best trying to find an answer before posting. My question is simple, if I use the wp_nav_menu function of wp, what should I do in the array or any other place... | After searching some more I found this great answer, they key was to use a custom walker. stackexchange-url ("Display a portion/ branch of the menu tree using wp_nav_menu()") Best. | wp_nav_menu show 1 item only | wordpress |
I am using wordpress 3.4.1. I am mainly creating a static site and for that have created and arrnaged the pages, and wordpress has nicely created the pages in proper nav-menu format for me, which is good. But, it has also added a link to 'Home' in the nav-menu. How can i remove that? NOTE: I prefer any other answer tha... | Here's a good solution posted over at .org http://wordpress.org/support/topic/remove-home-from-menu-1#post-2215239 You can remove the "Home" link using a filter. Add this to your Theme's functions.php file: <code> function mytheme_nav_menu_args( $args ) { $args['show_home'] = false; return $args; } </code> add_filter( ... | How to remove the HOME menu item | wordpress |
I have a custom page which uses a template called "Stores" <code> http://example.com/stores/ </code> . This page will have a list of states and/or companies as categories. For this system I have a custom post type "store" which can be assigned to a single category (either state or company), Each store is not a specific... | Create a Page Template Add a new page and give it the slug <code> stores </code> Add A Public Query Variable <code> add_filter('query_vars', 'add_state_var', 0, 1); function add_state_var($vars){ $vars[] = 'state'; return $vars; } </code> Add a rewrite rule This will direct your request to your <code> stores </code> pa... | Using custom/dynamic "slug" for a page | wordpress |
I have one page in my template where I would like to set a custom posts_per_page. Here is the code I have used: <code> <?php global $query_string; query_posts($query_string . '&posts_per_page=4'); if ( have_posts() ) : while ( have_posts() ) : the_post(); ... </code> Now this code limits only 4 items per page an... | Use a <code> pre_get_posts </code> action in your <code> functions.php </code> with conditional tags , and remove the call to <code> query_posts </code> : <code> function wpa62751_pre_get_posts( $query ) { if ( is_category( 'my-category' ) && is_main_query() ) $query->set( 'posts_per_page', 4 ); } add_action... | Custom posts per page does not work with pagination | wordpress |
Is it possible to print content of all menu items, when displaying menu (or branch of menu as in question about stackexchange-url ("displaying menu branches")) ? Once I click on <code> About Us </code> I wish for new page to display content of all it's children links. So basically I am looking for a way to get IDs of t... | I am lazy to write supporting logic from scratch so I am reusing functions from linked answer on branches: <code> /** * Retrieve IDs of posts in branch of menu. * * @param mixed $menu * @param string $branch_title * * @link stackexchange-url * * @return array */ function get_post_ids_from_menu_branch( $menu, $branch_ti... | How to get IDs for objects in menu branch? | wordpress |
I've got a few <code> gettext() </code> questions that are not covered anywhere in WordPress Codex but I think they are important. <code> __('string') </code> in THEME should be used for strings that are likely to be present also in main WordPress translation file. No textdomain necessary. Examples: one, two, submit, c... | Interesting questions, I'll try my best, but I hope others can also give input. re 1. Usually I use the theme's text domain also for strings that are likely to be present in the main WordPress translation file re 2. correct re 3. I think it is a good idea, but I don't know if it is bad practice or anything like that re... | Gettext details | wordpress |
how can I remove a parameter from a URL in wordpress? for example if I have the following URL: http://domain.com/?cat=4&paged=2&order=DESC How can I remove paged from it? | You should use pretty permalink. Please read this docs from WordPress Codex for full information. | Remove url parameter using wordpress | wordpress |
i'm following this tutorial: http://itc.webmaasters.com/nextgen-gallery-with-facebook-and-twitter-wordpress-tutorial-or-hack/ for implement Facebook Like Button on this plugin. It's working very well, but if you like the picture, this "like" does not appear in your timeline on facebook. On the photo you see the "countd... | why not use this plugin ? NextGEN Facebook Adds Facebook HTML meta tags to webpage headers, including featured images. Also includes optional Like and Send Facebook buttons. | Facebook Like Button with NextGen Gallery | wordpress |
I have the following code and while get_the_ID() works, $post-> ID does not, why? <code> $the_query = new WP_Query( array( 'post_type' => 'custompost', ) ); while ( $the_query->have_posts() ) : $the_query->the_post(); echo $post->ID; endwhile; </code> | Your WP_Query loop is incomplete. Your not checking if any posts were actually found before looping, nor are you presenting a message to show none were found, nor are you cleaning up afterwards. You're also using the 'other' syntax that breaks brace matching in IDEs, making your life harder. Try adding <code> global $p... | $post-> ID not working | wordpress |
Am using W3TC from a long time but from past few weeks am stuck, as I can't see my edits working. It was all fine in past but from a week my edits in style.css reflects back in like an hour after. http://i.imgur.com/f3LwQ.png http://i.imgur.com/rzydS.png http://i.imgur.com/bMffA.png http://i.imgur.com/XWniN.png http://... | The best way I can think of is to add a unique string to the end of the stylesheet include to get everything to update. For example, if you are including it in the header.php file: <code> <link rel="stylesheet" href="<?php echo get_stylesheet_uri(); ?><?php echo '?v='. time(); ?>" /> </code> Of course... | Problem with caching, W3TC | wordpress |
I'm using the WP Supersized plugin to load background images on posts and works fine. The problem I have at this point is I want to show the latest post in cat 17, with custom field key FeaturedOnHomepage, with value yes on my homepage and display the background images from that post. Below the query I use: <code> <... | Never mind. Switched to http://www.ajaxblender.com/bgstretcher-2-jquery-stretch-background-plugin-updated.html Much more control and working like a charm. | background images WP Supersized on homepage | wordpress |
Hi I have a custom post type and its posts are called via a shortcode on any other post or page. I'd like to paginate this post type, say display 10 items. So the page in the URL remains the same, but the content inside (via shortcode) changes when I go to the 2nd page from the pagination buttons. How do I do this? | Try to do a little research. This is documented all over the googlesphere. http://css-tricks.com/snippets/wordpress/paginate-custom-post-types/ http://wordpress.org/support/topic/custom-post-type-taxonomy-pagination?replies=14 | Pagination for custom post types | wordpress |
I'm having an issue creating an ajax search on my single post pages. I need to limit the search results to the custom post types "fod_videos" and "post" and category 12. My issue is the search is returning all the posts under those filters and not taking the search value. I'm guessing I'm missing something obvious but ... | Instead of <code> 'cat' => 12 </code> and <code> $wp_query </code> use <code> 'category_name' => slug </code> and <code> get_posts() </code> . Here is a basic example how it works: PHP <code> add_action( 'wp_loaded', array ( 'T5_Ajax_Search', 'init' ) ); /** * Ajaxify the search form. */ class T5_Ajax_Search { /*... | AJAX search on post pages by custom post type | wordpress |
I'm using <code> WPQuery </code> and <code> get_children($query_images_args) </code> to query attachments from the current page. If the current page has no attachments assigned I'm querying the images of the parent page. This works the way I want but there is one little extra I'm aiming for. I already asked a similar q... | I'm not quite sure how you're defining whether or not the current page has only "small" images. But I suspect the answer is right in the <code> wp_get_attachment_image_src </code> function, which returns not just the image url but also the width and height. So let's say you were only interested in images that are more ... | query attachments of parent page if attachments of current page are smaller than … | wordpress |
When I try to update wordpress from 3.2.1 to the latest one it stalls and does nothing. It used to ask for my ftp details, which I looked up online and added this to the wp-config: <code> /** Setup FTP Details **/ define("FTP_HOST", "localhost"); define("FTP_USER", "your-ftp-username"); define("FTP_PASS", "your-ftp-pas... | Try adding all of the following: <code> define('FS_METHOD', 'ftpext'); define('FTP_BASE', '/path/to/wordpress/'); define('FTP_CONTENT_DIR', '/path/to/wordpress/wp-content/'); define('FTP_PLUGIN_DIR ', '/path/to/wordpress/wp-content/plugins/'); #define('FTP_PUBKEY', '/home/username/.ssh/id_rsa.pub'); #define('FTP_PRIKEY... | Problems updating wordpress | wordpress |
Whenever somebody writes a post on our site, the Paly Voice (http://palyvoice.com) there are automatically a lot of <code> <div> </code> elements created. This is bad for layout, since we have a style that applies to divs that we don't want to apply to story styles. Is there a way to remove the automatic div inse... | You first should find out where the divs are coming from, since that's not normal behavior. Could be from a plugin or - as Damien said - copy-pasting a text from Word. To remove the divs you can do a simple <code> str_replace(array('<div>', '</div>'), '', $content) </code> either before storing the text in ... | Divs appearing everywhere in post content | wordpress |
I need to create a custom user role who will be able to create posts (of a specific post type) but not publish them (just like the current contributor role . I'm being a bit confused on how to create a new role or capability to achieve this. How/where do I start? Thanks UPDATE: I added these to the custom post function... | Adding a role is very simple. Creating custom capabilities is a little bit more to wrap your head around. When you register your custom post type , you define your capabilities for it. Essentially it is an array of "what do you want to count as this?". My example below will clarify this statement. <code> $caps = array(... | Creating custom user roles | wordpress |
I'm trying to create an admin option page without the Settings API for some reasons. Then if I do so, I've heard that I need to use nonces for security. I'd like to know the correct way to use them. This is what I've tried by following this page: stackexchange-url ("Using nonce external of WP Admin") admin. <code> <... | This is a very basic nonce setup for a plugin: Create your nonce input in the form: <code> wp_nonce_field( basename(__FILE__), $nonce_key ); </code> Then check your nonce once submitted: <code> if ( empty($_POST[$nonce_key]) || ! wp_verify_nonce( $_POST[$nonce_key], basename(__FILE__) ) ) return; </code> basename( FILE... | The Correct Way to Use Nonce Field without Settings API | wordpress |
I use the following code to extract the attached images from a post with ID: <code> $args = array( 'post_type' => 'attachment', 'post_parent' => $product_id, 'post_mime_type' => 'image', 'orderby' => 'menu_order', 'order' => 'ASC', 'numberposts' => -1 ); $attachments = get_posts($args); </code> The pr... | Simply add an <code> exclude </code> argument and use the <code> get_post_thumbnail_id() </code> function. <code> $args = array( 'post_type' => 'attachment', 'post_parent' => $product_id, 'post_mime_type' => 'image', 'orderby' => 'menu_order', 'order' => 'ASC', 'numberposts' => -1, 'exclude' => get... | Detect featured image among the attached images | wordpress |
I have a salon website with a gallery page wherein the user must first select a stylist prior to viewing their individual gallery. I planned on using NextGen to house the images in stylist specific galleries, and using the NextGen shortcodes(ex: <code> [nggallery id=1] </code> ) to determine which gallery gets shown on... | I am not sure to understand your question, but you have to read more wordpress/nextgen documentation. What you need to do exactly? Can you be more specific? I think, that if you create a set of pages (for each stylist) and use the respective shortcode of the gallery in the content, this will work fine. ex: in the page ... | conditional tags- how to use with shortcodes | wordpress |
I've been playing around with a lot of custom post types lately and I am pretty anal about my URL structure / routing. An issue I ran in to a with a site that I just developed was this: I had many custom post types, for example: <code> videos </code> The URL structure to 'view' the video list (ie: archive of sorts) was... | When you declare the custom post type, there is a parameter "rewrite" where you declare the slug for the post type. Change the slug to "media/videos", and then visit your Settings > Permalinks page to update your rewrite rules. <code> register_post_type( 'videos', array('labels' => array(), 'rewrite' => array( 's... | Custom post type routing with hierarchy | wordpress |
While my related question on Stack Overflow should explain the basic CSS for this once it gets answered, how would I define a custom font family for a wordpress blog that will only apply to a <span> and will not affect the site-wide font families being used by the theme on my wordpress site? Related: stackexchang... | You can use this function: http://codex.wordpress.org/Function_Reference/body_class Use this in your header.php <code> <body <?php body_class(); ?>> </code> This gives each page a different class and so you can use CSS to set the font-family for a specific page like so: <code> body.blog span.yourClassName{ ... | How to define a custom font family for a wordpress blog that will not affect the entire site | wordpress |
I need to customize the output of the shortcode of plugin A by using a function of plugin B. So I alter the shortcode function of plugin A by inserting a condition to check the value of the function of plugin B but I need to include the php file that supports this function. I tried all require_once, require and include... | The first error message means that there is restrictions in place on where you can include files from, set by the server. You could try with <code> require_once ABSPATH . '/wp-content/plugins/pluginname/pluginfunctions.php'; </code> but I'm not sure if it would work. With the second include you're trying to include an ... | How to include a plugin's php file to another plugin functions file | wordpress |
how can I use Cron to delete posts of a certain post type once they reach a certain limit, like keep maximum 50 posts? The reason is that these posts are being imported automatically periodically, so I want to prevent the DB getting too large, apart from the fact that the older posts won't be needed. | Although I do not understand the motivation for truncating posts, I think this exercise is valuable for you to understand how to use cron + WordPress. Create a function to truncate posts This can be used for both methods below WP-cron or UNIX cron. <code> function foobar_truncate_posts(){ global $wpdb; # Set your thres... | Delete posts from a post type automatically via Cron | wordpress |
I am using a homepage sorter to arrange the posts on the front page of my site because of that, I am getting the posts in this manner so that I can call each post individually instead of in a foreach loop <code> $args = array( 'numberposts' => -1,'category_name' => 'homepage'); $home_post = get_posts( $args ); $i... | <code> get_the_post_thumbnail() </code> expects the post ID as first parameter. So you need a post object like … <code> $home_post[1] </code> . <code> echo get_the_post_thumbnail( $home_post[1]->ID ); </code> … should do what you need. | help getting featured image using get_posts | wordpress |
I made a table out of the fields in a custom meta box I created, but now I'd like to know if I could have the table disappear if none of the fields were filled in. Is this too complicated, is there a better solution, or should I just try to fill in all the fields as much as possible? This is what I have so far: EDIT * ... | Probably the easiest thing to do would be to fetch the fields above your table, and assign them to variables: <code> $anime_anname = get_post_meta($post->ID, 'anime_anname', true); $anime_angenre = get_post_meta($post->ID, 'anime_angenre', true); ... </code> Then just wrap the table in an if statement that looks ... | Make table disappear when fields are left blank? | wordpress |
I notice in the Codex that the --add-drop-table option is displayed for backing up a database. Before I screw anything up, does this just mean that when the backup is eventually imported, the tables will overwrite if they exist in the destination db? I don't want to drop the tables when I back them up! <code> user@linu... | It only affects the output of your MySQL dump in the file that is created. It isn't necessary. It is just there so that if you import the created dump file into a database that already has a table with the same name, it will drop that table and then add the new table in its place. Otherwise you will get an error, and t... | Mysqldump add drop table? | wordpress |
I'm developing a home page that is a mishmash of a bunch of information, including a random smattering of several categories, including blog posts (category 192 in the code below) I'm obviously not invoking the standard WP loop to do this. Is there a way to get the date and author to echo properly: <code> <!-- RANDO... | The key to this is covered on the <code> get_posts </code> codex page: Access all post data using the <code> setup_postdata </code> function: <code> foreach ( $rand_posts as $post ) : setup_postdata($post); </code> Regarding <code> the_date </code> , see the note about multiple instances on a page: SPECIAL NOTE: When t... | Randomizing Post Links Outside of Loop - No Author or Date | wordpress |
I've got this in header.php in <code> <head> </code> section: <code> $page_color = get_post_meta($post->ID, 'page_color', true); </code> It works fine because it gets correct <code> page_color </code> for posts and pages but when I perform some search and search.php is run, it occasionally gets <code> page_col... | I don't think it's just occasionally, that will always get you the post meta of the first post on a search results page, a taxonomy page, an archive page - any page where there are multiple posts, because the <code> $post </code> global will always be populated with the first post of any main query result. EDIT- <code>... | Search.php gets metadata from first post | wordpress |
I know there have been a couple of questions in relation to this and had a look at them, but mine differs slightly on the problem experienced and the code. I am basically building my first theme and hoping to implement PrettyPhoto, I have been careful with enqueue'ing scripts and jQuery and have NivoSlider working ok, ... | Ok, after a few days trying various variations on the code I was originally using I still had no success. I took my theme right back to the bare bones, and tried the code again, I even tested the code of the TwentyEleven theme but still had no joy. I have an answer but not using the code above. To register and enqueue ... | Add_filter rel="prettyphoto" to WP3.4.1 | wordpress |
Okay so I learned how to add the wordpress login box to the site. I don't want the box style in sidebar but more of horizontal box in the top of the page under the menu in horizontal way. Are there any pointers for going with this route? | Use <code> wp_login_form() </code> and set the <code> p </code> elements per CSS inline, so they can sit side by side: <code> #loginform p { display: inline; } </code> | Wordpress Login Box horizontal at the top. | wordpress |
I have a URL: www.example.com/my_cool_pancakes. When a User goes to this URL, I would like the URL to instead be www.example.com/pancakes. How do I do this? Is this URL rewriting? I have studied URL rewriting, but I am still not sure about how it works, or even if it is the method I should use to do this. If it is, cou... | Could using the register_post_type parameters fit your needs? There's an option "slug" that will do so if has_archive is set to true... | URL rewrite( I think? ) | wordpress |
Am I missing out SEO-wise by not including any tags in general when I write posts on my blog? How do they help a site rank better? | From what I have gathered, Tags don't directly affect your SEO ranking - keywords put you "on the map", but really it's your content and popularity that will increase your ranking. However, many people rave that tags (properly [not overly] done) have a great affect on flow through your website. Example: You right a FAN... | How important are WordPress tags for SEO purposes? | wordpress |
My Wordpress theme (when enabled) overrides the rel value of the link of all images with rel="lightbox" using the following code: http://pastebin.com/Bsh739QY How can I edit the JQuery to check for the rel value first? If the rel value is already set to "lightbox[xyz123]" or "lightbox[xyz-123|abc]" or "lightbox", then ... | <code> /*-----------------------------------------------------------------------------------*/ /* Add rel="lightbox" to image links if the lightbox is enabled */ /*-----------------------------------------------------------------------------------*/ if ( jQuery( 'body' ).hasClass( 'has-lightbox' ) && ! jQuery( ... | Using JQuery to check for Rel Attribute of Image before Overriding It | wordpress |
With <code> <?php _e('Save Changes') ?> </code> , I know the phrase, "Save Changes" can be translated automatically if the user's locale is set to a different language. I'd like to know if there is a list of those already translated WordPress default messages. What else can I use? | The list is available in <code> $GLOBALS['l10n'][ $text_domain ] </code> . To get the looong list of translatable WordPress strings just use: <code> print '<pre>' . htmlspecialchars( print_r( $GLOBALS['l10n']['default'], TRUE ) ) . '</pre>'; </code> Do not use these strings in your theme or plugin. They are... | List of Default Translated Phrases | wordpress |
A while back I found that there was a reason to name a template like so template-name.php For the life of me, I can't remember what it was for. I thought it was so that WordPress would automatically pick up that template so that you would not have to set the page template when creating the post. I have been looking in ... | I always name them like so: page-name.php; This keeps my page templates nicely together + in some cases this can make your code easier, for example... <code> <?php // Get the file called loop-page.php get_template_part( 'loop', 'page' ); ?> </code> A quick Google revealed also this http://wp.tutsplus.com/tutorial... | what is template-name.php | wordpress |
How can I json_encode the output of this function I use to get all attached images of a post? <code> <?php function get_all_images($postid=0, $size='bigger', $attributes='') { if ($postid<1) $postid = get_the_ID(); if ($images = get_children(array( 'post_parent' => $postid, 'post_type' => 'attachment', 'num... | Not sure if the <code> get_all_images() </code> function is the one that is added to your wp_ajax_{action} hook. If it is you will want to output a string back to your js. I would define a variable and concatenate the img html to it as you loop through your images. <code> function get_all_images() { //your code $respon... | How can I json_encode the output of my function? | wordpress |
I would like to load some code before the template begins printing in BuddyPress. What filter or action hook should I use? I tried a number of them (such as <code> bp_head </code> , <code> bp_include </code> , <code> bp_init </code> ), but none of them seem to work. My code is simply never loaded. The list of filters a... | Untested, but I'd start with something like this: <code> add_action( 'wp', 'your_function', 3 ); function your_function(){ if ( is_page_template( 'some-template.php' ) ) { if( some condition ) locate_template( array( 'some-other-template.php' ), true ); else return; } else return; } </code> | What filter or action hook to use in order to load some code before the template begins printing in BuddyPress? | wordpress |
I am trying to create a "time since" post display so when someone views a post they will see "posted about a week ago" instead of the date. I've tried a few things but to no avail and I think it is because I found out that my default timezone is GMT (using date_default_timezone_get()) and my date.timezone (using ini_ge... | You don't need to know the user's timezone, because time since the post was published is independent of timezone. WordPress sets your timezone to UTC so that internally, all dates are dealt with the same and consistent timezone. You should avoid using php functions, and instead use the WordPress provided functions. Inc... | How to handle dates, trying to calculate time since a post | wordpress |
I have run into this problem where the following piece of code always returns true for any <code> post ID </code> supplied to it. <code> current_user_can('delete_posts', $post_id); </code> Normally, the above code should return false when the user is not the author of the post or does not have the capability to delete ... | After hours of fighting to get this to work, it was just a matter of changing <code> delete_posts </code> to <code> delete_post </code> . So, in it's entirety this would be: <code> current_user_can('delete_posts', $post_id); </code> to <code> current_user_can('delete_post', $post_id); </code> <code> current_user_can </... | Check whether user can delete a given post | wordpress |
I'm using <code> wp_list_pages() </code> to display a menu of child pages. The structure is nice and simple. Looks like this: http://cl.ly/image/0w1Q1q2D3D18 The menu works perfectly when on a child page: http://cl.ly/image/3O310E0s2B3d But, alas, does not work when on the parent page: http://cl.ly/image/3w0T3Q2s4347 S... | Your code won't work if you have more than one parent page or multiple levels of child pages. Use <code> get_ancestors </code> to get the top parent page, and use the <code> child_of </code> argument of <code> wp_list_pages </code> rather than <code> exclude </code> to only output pages from that branch. | Exclude current page in wp_list_pages | wordpress |
I'm having a bit of a problem with the <code> bloginfo() </code> function in Wordpress which I've never had before. Normally I use <code> <?php bloginfo('template_directory'); ?>/rest of image link here </code> but for some reason now it doesn't work. When I view source, it's not echoing out the link like it's su... | Use <code> get_stylesheet_directory_uri() </code> and <code> get_template_directory_uri() </code> instead. Note that these functions return rather than echo their result. So, for example: <code> <img src="<?php echo get_template_directory_uri();?>/images/Lynx.gif" alt="castandtubular"/> </code> | Wordpress function bloginfo not echoing output on parts of the pages | wordpress |
I am developing an author badge for my Wordpress site and I am learning how to call meta functions (needs to be within The Loop). The meta functions that I am calling are author bio related, like username, last name etc Here is a code example: <code> <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?... | Add your author meta information after if ( have_posts() ) : <code> <?php if ( have_posts() ) : the_post(); ?> About <?php the_author(); ?>, the author of this blog <?php userphoto_the_author_thumbnail() ?> <?php echo get_the_author_meta( 'description' ); ?> <?php rewind_posts(); while ( have... | How to call the_author_meta and make it work? | wordpress |
How can I convert functions like the_permalink() into strings like $permalink? | Use <code> get_permalink() </code> function which returns a value instead of printing it. Example - <code> $permalink = get_permalink($id); //$id if using outside loop </code> | Convert function output into string | wordpress |
Yoasts SEO plugin adds a metabox to the post edit screen. I'm trying to remove this for users who aren't editors or above. I've tried putting a <code> remove_meta_box </code> call in on admin_init, trying to remove the action on $wpseo_metabox but to no avail. How do I remove this metabox without requiring user interve... | On <code> remove_meta_box </code> is a note: Because you can't remove a meta box until it's been added, it's important to make sure your call to remove_meta_box() happens in the right sequence. WordPress SEO adds meta boxes on <code> add_meta_boxes </code> action with default priority - 10, which run after <code> admin... | Remove the Yoast SEO Post Metabox | wordpress |
Ok I know browser detection is considered bad practice but I can't find a way around it because I really do need whole different themes for a complex site. So I snatched this function from http://detectmobilebrowsers.com/ <code> $useragent=$_SERVER['HTTP_USER_AGENT']; if(preg_match('/android.+mobile|avantgo|bada\/|blac... | You can use the built in function <code> wp_is_mobile() </code> Override a style with wp_enqueue_style <code> add_action('wp_enqueue_scripts', 'my_mobile_styles'); function my_mobile_styles(){ if(wp_is_mobile()){ wp_register_style( 'my-mobile-style', 'URL_to_stylesheet', array('id-of-main-stylesheet') ); wp_enqueue_sty... | Load a theme based on browser detection | wordpress |
Is there any way of generating the title tag of a page from the content of an H1 tag on my wordpress page? I've got some dynamically generated content pulled in via an external XML feed and and at the moment, as the page isn't physically generated via the wordpress admin system and is just using a template, the page ti... | If you can pull the XML feed before the Title gets set then you could easily use information from the XML feed (and thus the H1) in the title. I guess you need to ask yourself these questions: Can I pull the XML before the title is processed? When creating the H1 are there any other dependencies that are only available... | Generate page title tag from the content of H1 | wordpress |
Within admin pages can one target specific pages based on their body class, as in the front end? For example I created a custom post type and would like to target its add and edit pages for some CSS tweaks. How do I go about that? | Found this, but it really should be in WordPress Core: <code> // Body class for admin // http://www.kevinleary.net/customizing-wordpress-admin-css-javascript/ function base_admin_body_class( $classes ) { // Current action if ( is_admin() && isset($_GET['action']) ) { $classes .= 'action-'.$_GET['action']; } // ... | Target admin page body via CSS class | wordpress |
Hi I am trying to creating some custom options for a template I am developing but I seem to be getting an error: <code> Warning: Illegal string offset 'show_header' in C:\xampp\htdocs\wordpress\wp-content\themes\01MyWork\includes\theme-options.php on line 62 </code> This is the line that seems to be throwing the error:... | I believe the underlying problem is that the option array keys don't exist yet . Let's start here, in your initialization function: <code> if( false == get_option( 'thanathos_theme_display_options' ) ) { add_option( 'thanathos_theme_display_options' ); } </code> First, this: <code> false == get_option( 'thanathos_theme... | Wordpress Settings API error | wordpress |
I have a site made with word press. I came across a requirement where a developer tries to log in from an ipad or iphone into word press site. Is there any plugin to achieve this ?. there is a necessity to get back the data in json format and give to developer !! | When you say developer, I immediately assume you mean someone trying to add content to the site? There is a WordPress app that you can add your site to, and add Posts, pages, view stats, etc. | How to post data to a word press site in case of a mobile app | wordpress |
Here describes get_posts() function. I would like to know what types of order can I pass to <code> get_posts </code> ? in WP admin, I can see menu order, title, date, random and ... | Refer to the <code> WP_Query() </code> docs for <code> order </code> and <code> orderby </code> : order (string) - Designates the ascending or descending order of the 'orderby' parameter. Defaults to 'DESC'. <code> 'ASC' </code> - ascending order from lowest to highest values (1, 2, 3; a, b, c). <code> 'DESC' </code> -... | what types of order can I pass to get_posts() via orderby? | wordpress |
Everyone has been telling me I should use Git. What I don't understand is how git interacts with your IDE. Say i'm developing on Dreamweaver, and I switch branches, my IDE isn't going to reflect that so how do I get the two aligned? Plugins? = more complicated than simple FTP sync ... Or am I missing something? | I don't know Dreamweaver at all, but it certainly has the ability to know when an underlying file has changed, yes? Suppose you open an html file in Dreamweaver. Suppose you open it also in vim or TextWrangler; were you to save it in vim or TextWrangler, would it throw an alert to reload the file in Dreamweaver? If so,... | WordPress and Git: How does Git interact with your IDE? | wordpress |
I registered a new post type, and I was wondering what the difference was between the $args and labels array. Read more about it in the codex (can't have more than two links, sorry). For example, labels (code from this CPT tutorial ) 'labels' => array( 'name' => __( 'Super Dupers' ), 'singular_name' => __( 'Super Duper... | The code you posted is an incomplete copy/paste of the code from the tutorial you linked. <code> labels </code> is a parameter within the <code> $args </code> array: <code> $labels_array = array( 'name' => _x('Books', 'post type general name') ); $args = array( 'labels' => $labels_array ); register_post_type( 'bo... | Custom Post Types — $args vs. labels array | wordpress |
I'm looking for how to get a class in the wp_get_archives functions to get the current month (when we are in a month archive) just like when we call wp_list_categories, the current category has a ".current-cat" selector for CSS or when we call wp_list_pages we have a '.current_page_item' selector. | Put the following function in your <code> functions.php </code> <code> function wpse_62509_current_month_selector( $link_html ) { $current_month = date("F Y"); if ( preg_match('/'.$current_month.'/i', $link_html ) ) $link_html = preg_replace('/<li>/i', '<li class="current-month">', $link_html ); return $lin... | wp_get_archives() - Get CSS selector for current month | wordpress |
After a post is updated there is a message displayed, how can I change the displayed text? I would like to remove the "view post" link and change the 'Post published' text. I'd like to do this for a particular post type. Here is the html WordPress outputs: <code> <div id="message" class="updated below-h2"><p&g... | Solved: <code> add_filter( 'post_updated_messages', 'feed_updated_messages' ); </code> See http://codex.wordpress.org/Function_Reference/register_post_type | Modify message displayed on post save | wordpress |
On my site I want to add a section just below Navigation and above-content (from where posts starts to show up on front page) which would show a panel where I can put any BREAKING NEWS (not always, whenever I want) with its excerpt and image. That panel should stretch with max-width. I want to pull that BREAKING NEWS f... | It's certainly possible, and is a common thing to do with WordPress: <code> <?php $q = new WP_Query('category_name=category_breaking'); // query that gets all posts in category "category_breaking" if( $q->have_posts() ) : // if there are posts returned by query... echo "<div id='breaking_news'>"; // start t... | Full Width Main Post | wordpress |
I have interactive pdf documents that I need to put on a wordpress site. Visitors need to be able to fill these in and print them out to sign and post. They do not need to be emailed or saved to the site. I have tries embedding them with all kinds of plugins but all they do is embed a non fillable pdf. What I need is t... | How did you tried to embed them? Is it post or page? My solution would be to add it into an <code> iframe </code> , add code below as html to your page/post. <code> <iframe frameborder="1" height="200" name="frame1" scrolling="yes" src="http://download.belastingdienst.nl/belastingdienst/docs/aangifte_bpm_verzoek_ter... | Embed interactive pdf | wordpress |
EDITED MY QUESTION TO MAKE IT WAY MORE CONCISE Using Wordpress plugin Events Manager, my goal is to alter the search form so it searches for events on single dates. I don't want a date range search which is built in. Most of my events are nightclub events, which carry on to the next day. Therefore, I also want to alter... | I discovered a setting that solves this problem without having to hack the code: Events manager settings page -> Pages tab -> Event/List Archives You'll find an option "Are current events past events?" set to yes. This will, for example, cause searches for sunday to not display events that started the saturday before. ... | Plugin: Events Manager - Search by start date only | wordpress |
Probably quite a simple problem.. I have a custom post type with taxonomy terms. I wish to run a function from my functions.php whenever the admin ticks a specific term box. My original thought was to use add_action along with a "save_post" action so when the post is saved, it would loop through my terms and if the des... | In your emailfunction, check if the date is difrent from the publish date, if so, don't email. This will cause you to email only once? | Running a function only once when a taxonomy term is changed | wordpress |
I'm creating a plugin that will need to add a new WP page upon activation and then I want it to remove that same page upon uninstallation. Do I have to manually store that page id in the DB somewhere or is there a native WP option to remember that automatically? My code so far: <code> register_activation_hook(__FILE__,... | Why do you need to create a page? Its possible that before plugin deactivation, the page no longer exists, so your deletion function will need to check for if it exists But yes you will need to store the ID somewhere. Best option is to just update_option('icreatedapage', $pageid); <code> if ($pageid == 0) { echo "Somet... | How to add and remove a page | wordpress |
I'm attempting to create an API through Wordpress exposing some of my back-end data. I've come to the conclusion that I cannot have a stand alone page (plugin) exposing this data because Wordpress is always attempting to call it and it had be be behind some sort of action hook. My solution was to create an AJAX call w/... | You need a die(); before the closing } of the function and you might want to add the relevant php header to tell the browser it's content-type I wouldn't worry about the browser returning the wrong content type. As long as your code loading the data treats it as JSON So for your function try this instead <code> functio... | Exposing data using a custom Wordpress API | wordpress |
I'm in the process of creating a theme that will have several different setup options based on input from the administrator. One of the options will be to have a Zurb or Basic type layout. I'm working with SCSS and want to have my stylesheets in a separate sub folder from the main theme files, cleanliness aside this is... | Answered by @Vino here: stackexchange-url ("stackexchange-url "File <code> wp-includes/class-wp-theme.php </code> , line 191, WP 3.4.1 source. but... there are no filters, and the class is <code> final </code> . You can edit at your peril, 'cause updates to WP will overwrite your efforts." | Sub folder CSS that's read by Admin panel | wordpress |
I actually have a custom date registered in UNIX Time in my database like this: meta_key : custom_date meta_value : 1322697600 and the type of the meta key is a longtext I would like to retrieve specific post according to the year of this custom_date I would like something like this : <code> $args = array( 'paged' =>... | PHP has a built-in <code> date() </code> function that formats Date-objects. In your case, you would use it as follows: <code> echo date('Y', 1322697600); </code> Since you're using these query arguments to build up an array of posts, and you want to filter specifically on that, I'd recommend building a function that t... | Query by custom dates in UNIX Time | wordpress |
I'm using the enter_title_here filter to modify the 'Enter title here' text in a custom post type, question is what hook should I use to trigger this function? I have used admin_enqueue_script as a test and it worked, but I think there is a better hook since this is not really a script. <code> function print_scripts() ... | Answer was the one by @RutwickGangurde: You just need to call the filter enter_title_here. No action hook is required for that. Yes, for enqueuing the script, admin_enqueue_scripts will do. | Which hook should be used in this case? | wordpress |
I want to count how many people visit my wordpress-website an want to know the following data: visitors per day/week/month/year (with history) which subpage/article attracts the most visitors Is there a plugin that can do that? | There are a number of ways of achieving this but the two ways I would concider would be Google analytics - http://wordpress.org/extend/plugins/google-analytics-for-wordpress/ Wordpress Sitestats - http://wordpress.org/extend/plugins/stats/ or install http://wordpress.org/extend/plugins/jetpack/ as it comes with that. | Best way to count visitors? | wordpress |
Hi I am trying to learn to add theme options to WordPress themes by reading The Complete guide to WordPress Settings Api on wptuts I have gotten as far as the 4th part and have stoped to create an example for myself because I have gotten confused with how can I add the sections I create in a page.Here is my code: <code... | I think you may need to use the functions <code> settings_fields </code> <code> do_settings_sections </code> and <code> register_setting </code> as well as <code> add_setting_section </code> to get this working see refs. to these functions here . I'm not sure if you could get a bare bones version working leaving some o... | WordPress add options to theme not displaying | wordpress |
Ok, so I'm pretty confident on how to display a certain post's custom field content on my home page, or wherever I wanted it. But what I'm trying to do is this: I have my main home page that I want to display content from the newest post everyday. In other words, I have an area where I need to display the newest post's... | It sounds like what you need is a custom secondary loop, probably using <code> WP_Query </code> , that just queries for your single most recent post. Once you have that, you can use <code> get_post_meta() </code> to grab the custom meta from that post in a new loop. Edit: Alternately, you can use <code> get_posts() </c... | Display newest post's custom field content on homepage, daily | wordpress |
So I have got one hater in India who bombarded on my adsense ad units. Luckily I didn't get banned from Google. I have blocked Indian visitors from my site using iq-blockcountry plugin (wordpress). Now I want to know if there's any procedure so that I can allow the Indian visitors but hide the adsense units from them? ... | A quick google search gave me this. This plugin seems to have this feature: http://wordpress.org/extend/plugins/ad-injection/faq/ <code> How can I show different ads to people in different countries? If you install the Country Filter plugin (with the IP database) then you can use the following code in the direct ad ins... | Blocking adsense ad units for a particular country | wordpress |
I'm trying to set 'orderby = none' to my loop but it is not working. Here's my code: <code> $query = new WP_Query(array('showposts'=>2, 'post__in' => array(99,4,5,2,8,55), 'orderby'=>'none')); </code> Could anyone help me? Thanks. | Order by none doesn't do what you think it does. If you don't specify an order, then MySQL doesn't guarantee any particular order and will simply get the posts in whatever order it has them. Since they were inserted in a particular order, then you'll probably get them in that order. Since you need the posts in a specif... | Orderby = none not working | wordpress |
Hi I have just learned how to add jQuery to wordpress themes and it works but an error keeps appearing in the wordpress development tool.Here is the code that I posted: <code> function register_js(){ if(!is_admin()){ wp_deregister_script('jquery'); wp_register_script('jquery' , 'http://ajax.googleapis.com/ajax/libs/jqu... | Your primary problem is that you are de-registering core jQuery . Don't do that. Ever. Period. If you get rid of that, your other scripts will work properly. Just do this: <code> function wpse62373_register_js() { if ( ! is_admin() ) { wp_enqueue_script('quicksand', get_template_directory_uri() . '/js/quicksand.js', ar... | Wordpress jQuery is not defined error | wordpress |
I'm making a plugin with an administration page witch uses the Settings API. I could make one section and one option. But how can I add other form fields to it? If I add an input tag to the callback function, it adds it to the same field. Does that mean that if I want to add another field, do I have to create another f... | You're using same callback function for both setting fields. Use different ones with it's own inputs. Here's updated code: <code> <?php /* Plugin Name: Settings API Demo Description: Learning Setting Field and Settings Section Author: Teno */ add_action('admin_init', 'settingsapi_init'); function settingsapi_init(){... | Adding Form Fields with Settings API | wordpress |
I am trying to grab posts of post type "leads" (see below for the code I am using) however the query produced (obtained via debug queries) is including the clause 'where post_type in ("leads", "leads", "product_description", "custom_products")' [[notice leads is there twice]] This leads me to think that somehow somethi... | I built a workaround for now, but would really love to know what is causing this. The workaround was obtained by removing changing "suppress_filters" to true and then adding a function that adds to the where clause of the SQL... But I would rather know how to fix this at the root rather than a bandaid My workaround was... | get_posts() seemingly ignoring post_type | wordpress |
I'm using the default comments template. When I send a comment I get the following error message: Warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'wp_set_comment_cookies' not found or invalid function name in /home/mattator/public_html/wp-includes/plugin.php on line 403 Warning: Can... | Well, I experimented a little bit, and as turns out the problem was a call to the function "nocache_headers()", in Line 18 of the file "wp-comments-post.php" which lies at WP root directory. I deleted it, and voila, everything works. Not sure why though. | Wordpress error when sending comment | wordpress |
I'm currently working on a community site for a fairly large blog (approx 500,000 uniques/month). I've decided I want to do a Network for all the different portions of the community site to keep the DB load to a minimum. IE: - A site for a user generated recipe site - A site for a user forum (using wordpress) - A site ... | The main issue with the rewrites is clashes, not maintainability, since that code would have worked in 3.1 and 3.4 and is unlikely to break, and if it did there'd be deprecated notices for a few versions. I would suggest using renamed posts, but instead use code like this: <code> function change_post_menu_label() { glo... | Looking for Direction regarding Custom Posts | wordpress |
I would like to use a custom meta box to build the UI for the post title, instead of the usual field 'title' supplied on WordPress post screens. I've build the meta box, the question is now how to save that field as the post_title. Anyone has done this before? | Is it really necessary to override default Wordpress title filed? instead I'd recommend using a different meta key such as - <code> my_the_title </code> to store the title into database. And then use wordpress function - <code> get_post_meta() </code> to show it, instead of <code> the_title() </code> function. | Use Metabox to enter Post Title | wordpress |
I used to have many plugins installed on one of my sites, and after deleting most of them, I still have a database full of extra tables, I am sure most of them are unused. How do I clean them off? | Backup your Database and then use DROP statements to delete the tables manually via tools such as MySQL Workbench, or MySQL Query Bench. There are many alternatives you can use that provide GUIs for backuping up, restoring, and modifying DBs. Here's the WordPress DB schema, do not delete any of these tables: http://cod... | Clean database from unused tables | wordpress |
I am developing a Wordpress plugin handling a calender in which it is possible to sign up for a given event. As part of this, I want to make a custom page for the signup-form and confirmation message to the client, however I have no idea how to do this. I have seen that there is a wp_insert_post() function to insert a ... | You can use <code> wp_insert_post </code> for creating the page. <code> <?php $content = '<Sign up form content>'; wp_insert_post(array( 'post_title' => 'My page', 'post_content' => $content, 'post_type' => 'page', //VERY IMPORTANT 'post_status' => 'publish/draft' )); </code> Check it. | How to get a custom page through plugin? | wordpress |
I would like to store a few extra details for my custom post type, using meta boxes. Should I store all the values under one meta key in an array, or create several meta key and value pairs? | If you want to use the values to sort or filter the data, you should keep them as separate entries. | How to store meta field values | wordpress |
This blog page is pulling from a Page Template called full-width-blog.php. The left of the content is where the supposed general posts should appear. On the right is the sidebar. How could you make the main left area pulling from Recent Articles and not from Testimonials? See image for an example: http://i.imgur.com/gV... | This is an attempt to fix your sidebar code : <code> <div id="rightcolumn-wrapper"> <div class="rightcolumn-inner"> <?php /* Widgetized sidebar */ if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('sidebar') ) : ?> <?php /* If a title has been provided, we'll use that. */ $NewsTitle=get_... | Recents posts pulling from different post type | wordpress |
I have created a page template that displays the featured image for all posts of a certain custom post type. It uses a normal loop that is querying that specific custom post type. The thumbnails are being displayed using <code> <?php the_post_thumbnail('project-thumb'); ?> </code> I now want to use a lightbox to ... | You could use WordPress’ built-in Thickbox script. Just place the following code somewhere before <code> wp_footer(); </code> : <code> add_action( 'wp_footer', 't5_thickbox_jquery' ); function t5_thickbox_jquery() { ?> <script> jQuery( 'a img.size-medium, a img.attachment-thumbnail' ) .parent() .addClass( 'thi... | Page template that uses lightbox to display post images | wordpress |
Im having an issue in my category set-up logic Let's say I sell new/used (including Vintage) Drums/Drum Parts wherein a user can search by new, used or by individual part. So let's say they choose to search by individual part on Cymbals. The search results page should then display a listing of Cymbals should also be gr... | you can achieve the same with out the duplication in two ways: create a custom taxonomy for condition (new,used) use a custom field for condition (new,used) both ways you only need to create each category only once and filter by condition. | Categories: A Greenhorn Question on Strategy (Not Code) | wordpress |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.