How to add checkbox with multiple values in table?

Right now i changed from `options` table to my own table so things are getting difficult i have a checkbox its name is `selection` in table, so here is what i tried               <input type="checkbox" name="selection" value="1"<?php checked("1",$item['selection']);?> />     <input type="checkbox" name="selection" value="2"<?php checked("2",$item['selection']);?> />     <input type="checkbox" name="selection" value="3"<?php checked("3",$item['selection']);?> />      This is not saving any value , Then i tried as array in below               <input type="checkbox" name="selection[]" value="1"<?php checked("1",$item['selection']);?> />     <input type="checkbox" name="selection[]" value="2"<?php checked("2",$item['selection']);?> />     <input type="checkbox" name="selection[]" value="3"<?php checked("3",$item['selection']);?> />      It is throwing warning `Warning: mysql_real_escape_string() expects parameter 1 to be string, array given` How to store multiple values with the same name in checkbox when using my table ? Any help help would be greatful.


Let Posts be stored in another table

I am trying to develop a plugin that creates a new table in the Wordpress database and I want to store there some kind of posts I create. I am trying to understand how to "clone" the Wordpress Posts/Add New/Categories/Tags and store the posts not in wp_posts, but in another table (eg.: wp_special_posts). At the moment I have the function that creates the table at the plugin activation, I created the page that grabs the information from the DB and display them using _WP_List_Table_ , but I do not have an idea on how, and if it is possible, to clone those sections. And help? Hint? **UPDATE** I want to create a product section with its own table, called _wp_product_instore_ , and I also want to use the standard _post-new.php_ interface, but put the posts in the _wp_product_instore_ table instead of _wp_posts_.


Out of memory error reporting

When users upload very large photos and memory is tight, it seems like Wordpress runs out of memory - fails to resize the uploaded photos and does not create the necessary metadata (`_wp_attachment_metadata` entry in `wp_postmet`a is not created). The worst part is that the user is never notified. At most I get an "HTTP error" message. Is is possible to somehow add an error message that will warn the user and remove the inconsistent file/database entries? How come this is not standard WP behavior?


Error when editing meta fields from all post view

Got a bit of an issue with my meta tags. I'm using the all in one seo plugin which has the rather useful feature of editing the title and description straight from 'all posts's page. The problem is there are apostrophes in all my fields, which seems to throw the error 'Uncaught SyntaxError: Unexpected token ILLEGAL' each time the edit button is pressed and doesn't let me edit within the page. If I remove the apostrophes by going into the whole post the field becomes editable from 'all posts' view again. Is there a way to strip out all the apostrophes from title and description or a way to not throw that error when i click the little pencil next to the field?


How to style only part of the category names?

My categories are all two words, such as: Name X Name Y Name Z How can I style the X, Y, Z as bold and leave the Name as normal? I can do so in the menu, simply by adding `<b>` tags around the X, Y and Z. But of course, this doesn't work in the Edit Category name field. The category is output on the single post pages with: `<?php $the_cat = get_the_category(); $category_link = get_category_link( $the_cat[0]->cat_ID ); foreach((get_the_category()) as $category) { echo 'slug.'" href="'.$category_link.'">'.$category->cat_name.'' ; } ?>` Am I missing something really obvious here?! Thanks in advance, I'm going round in circles here! :)


Including a meta box on a plugin page

I want to include the 'Comments' meta box (the one usually seen on the post creation page) on my plugin's admin page. Is there a way to do that? I am aware of how you can use add_meta_box() to add a custom one, but I want to simply add the comments meta box of a specific post on a particular admin page. Any ideas?


Given the ID of a product in woocommerce, how can I get its URL?

Say I have the ID of a product in wooCommerce; can I generate its URL somehow? (example /shop/fresh-apples)


How to change Calendar military time to eastern standard?

Below is an image of a calendar entry. The time is in military time and there are also a pair of rogue parenthesis after the time display. ![enter image description here](http://i.stack.imgur.com/sSiKF.png) I want to know how to convert this to eastern standard time and remove the parenthesis. I went into the Plug ins Javascript file and I understand how to remove the time altogether but that's not what I want. The WordPress instance already has it's General time set to eastern standard with a non military format.


Network shared post error You do not have permission to upload files to site + 500 internal server error

I am using Network Shared Post plugin in my wordpress 3.6 website to use users images themselves. But when a user try to use other people files, it shows an error message > "You do not have permission to upload files to site: ..." and i can see google chrome browser console > wp-content/plugins/network-shared-media/media- > upload.php?type=image&tab=library&post_id=0&blog_id=1 500 (Internal Server > Error) What can I do to solve this issue ?


Switching off shipping in WP-eCommerce

My client needs to work out the shipping only after someone has made a "purchase" on his site so by default, this option needs to be switched off and yet, when I switch shipping off, I still get shipping options coming up everywhere. I could hide this with CSS but if the option to switch off shipping is there, I would like to be able to use it. Is there something else I need to perhaps switch off/set? Thanks


Elegantly using JavaScript on widget admin forms

I'm working on a project involving a lot of widgets, and I'm thinking it'd be really great to have a "More options" section built using jQuery UI Accordion that expands when clicked. So, I've enqueued 'jquery-ui-accordion' using the 'admin_enqueue_scripts' action:               function add_my_deps() {         wp_enqueue_script('jquery-ui-accordion');     }         add_action( 'admin_enqueue_scripts', 'add_my_deps' );      ...And my JavaScript looks something like this:               (function($){         $('.more-options-expansible').accordion();     })(jQuery)      **Now what?** If I enqueue that via the "add_my_deps" action above, it only works if I reload the page (I.e., when placing the widget, the JavaScript is instantiated before the element is created; if the widget is saved, its JavaScript is enqueued as normal and it instantiates as normal.). If I place that in a `<script>` tag at the end of my HTML output in my widget's `form()` method, I get the following exception: `Uncaught TypeError: Object [object Object] has no method 'accordion'`. This is because it seems to be instantiating the accordion via the inline `<script>` before the jQuery UI Accordion library is loaded. Is there something obvious I'm missing? I'm using a simple jQuery instantiation for this example, but it seems like I'd have even worse issues if I tried to do anything using AJAX (Namely, how would I select the appropriate element to place the response in? Is this something I need to start using Backbone.js to accomplish?). Any help?


Where's did this div element come from?

This div element is causing a big gap on my wordpress page, specifically on the single post page. It's nowhere in the themes, I can't seem to find where this div element is coming from. Have you encountered this before (the highlighted element)? ![alt text](http://i.stack.imgur.com/0meHU.png) **PS** : Happens on chrome only. **UPDATE:** Still having this problem even with the stable chrome. Help anybody? **UPDATE2** : I think its the syntax highlighter plugin. And I also found out all other wordpress blogs (that I've checked) have this div. And the code's height in the post adds to the height of the div.


how many visitor open this post?

i want to create, how many visitor open this post it display in homepage below of summary like this .how i can do it? my site.my css code                    /***** Structure and Layout *****/     body { font: 62.5% Arial, "Helvetica Neue", Helvetica, sans-serif; color: #666; }     #angles { position: relative; width: 100%; }     .inner-wrapper { position: relative; width: 960px; margin: 0 auto; }     #column-container { position: relative; width: 960px; background: #fff url(images/backgrounds/bg-sidebar.gif) repeat-y top right; padding: 20px 0 0; }     #column-container-left { position: relative; width: 960px; background: #fff url(images/backgrounds/bg-sidebar.gif) repeat-y top left; padding: 20px 0; }     #column-container-wide { position: relative; width: 960px; background: #fff; padding: 20px 0; }     #left-column, #right-column { position: relative; width: 640px; }     #right-sidebar, #left-sidebar { position: relative; width: 320px; }     #right-sidebar, #right-column { float: right; }     #left-column, #left-sidebar { float: left; }     .video-sidebar { position: relative; width: 300px; margin: 0 10px 20px; padding: 0 0 20px; border-bottom: 1px solid #d9d9d9; }          /***** Float Classes and Clear Float Fix *****/     .clear { display: inline-block; }     .clear:after { display: block; visibility: hidden; clear: both; height: 0; content: "."; }     /* Hide from IE Mac \*/ .clear { display: block; } /* End hide from IE Mac */     .alignleft { float: left; }     .alignright { float: right; }          /***** Main Nav Bar *****/     #mainnav-bar { position: relative; width: 960px; margin: 0 auto; background: #fcfcfc url(images/backgrounds/bg-main-nav.jpg) repeat-x bottom left; border: 1px solid #d9d9d9; z-index: 98; }          /***** Main Navigation *****/     #mainnav-bar ul { position: relative; float: left }     #mainnav-bar li { float: left; background: url(images/backgrounds/pipe-mainnav.gif) repeat-y top right; line-height: 40px; position: relative; }     #mainnav-bar li:hover { visibility: inherit; }     #mainnav-bar li a, #mainnav-bar li a:visited { display: block; color: #464646; font-size: 1.3em; font-weight: bold; padding: 0 15px; text-decoration: none; position: relative; }     #mainnav-bar li a:hover, #mainnav-bar li a:active { color: #fff; background: #464646 url(images/backgrounds/bg-main-nav-hover.png) repeat-x top left; }          /***** Main Navigation Dropdown Menu *****/     #mainnav-bar ul ul { position: absolute; top: -999em; width: 20em; background: #e6e6e6; border-left: 1px solid #d9d9d9; border-right: 1px solid #d9d9d9; border-bottom: 1px solid #d9d9d9; background-image: none; margin: 0; }     #mainnav-bar ul ul li { clear: left; width: 100%; border-top: 1px solid #d9d9d9; padding: 0; background-image: none !important; line-height: 3em; }     #mainnav-bar ul ul li:first-child { border: none; }     #mainnav-bar ul ul li a, #mainnav-bar ul ul li a:visited { font-size: 1.1em !important; color: #323232; background-image: none !important; }     #mainnav-bar ul ul li a:hover, #mainnav-bar ul ul li a:active { background: #1b1b1b; color: #fff !important; }          /***** Show Main Navigation Dropdown Menu *****/     #mainnav-bar ul li:hover ul, #mainnav-bar ul li.sfHover ul { top: 4.1em; left: 0; z-index: 99; }          /***** Hide Main Navigation Flyout Navigation Level 1 - 3 *****/     #mainnav-bar ul ul li:hover ul, #mainnav-bar ul ul li.sfHover ul,     #mainnav-bar ul ul ul li:hover ul, #mainnav-bar ul ul ul li.sfHover ul,     #mainnav-bar ul ul ul ul li:hover ul, #mainnav-bar ul ul ul ul li.sfHover ul { top: -999em; }          /***** Show Main Navigation Flyout Navigation Level 1 - 3 *****/     #mainnav-bar ul ul li:hover ul, #mainnav-bar ul ul li.sfHover ul,     #mainnav-bar ul ul ul li:hover ul, #mainnav-bar ul ul ul li.sfHover ul,     #mainnav-bar ul ul ul ul li:hover ul, #mainnav-bar ul ul ul ul li.sfHover ul { top: 0; left: 20em; }          /***** Main Navigation Current Menu Item Highlighting *****/     #mainnav-bar ul li:hover, #mainnav-bar ul li.sfHover:hover { background: url(images/backgrounds/pipe-mainnav.gif) repeat-y top right; }     #mainnav-bar ul ul li:hover, #mainnav-bar ul ul li.sfHover:hover { background: #d5d5d5; background-image: none; }          /***** Home Page Magazine Content *****/     .headlines { position: relative; width: 640px; background: url(images/backgrounds/bg-home-columns.gif) no-repeat center top; padding: 15px 0 0; margin: 0 0 20px; }     .home-column { position: relative; width: 300px; float: left; padding: 0 10px; }     .home-column h2 a, .home-column h2 a:visited { font-size: 1.1em; text-transform: uppercase; text-decoration: none; padding: 0 8px 0 0; }     .home-column ul { margin: 10px 0 0; }     .home-column li { padding: 10px 0; border-top: 1px solid #e7e7e7; width: 300px; overflow: hidden; }     .home-column .home-thumb li { overflow: hidden; width: 300px; }     .thumb-text { position: relative; width: 220px; float: right; }     .home-column h3 a, .home-column h3 a:visited { font-size: 1.2em; font-weight: normal; color: #464646; text-decoration: none; line-height: 1.5; }     .home-column p { color: #a5a5a5; font: 1.2em/1.5 'VollkornItalic', serif; margin: 1px 0 0; }     .home-column .sidebar-archive-thumb p, .home-column .lead-thumb p { margin: 0; }     .home-column p a, .home-column p a:visited { text-decoration: none; }     .home-column p a:hover, .home-column p a:active { text-decoration: underline; }     .home-headlines h3 a, .home-headlines h3 a:visited { background: url(images/backgrounds/list-arrow.png) no-repeat 0 0.3em; display: block; padding: 0 0 0 15px; }     .home-headlines p { margin: 1px 0 0 15px; }     .lead-thumb { position: relative; }     .lead-thumb a, .lead-thumb a:visited { display: block; width: 290px; height: 125px; border: 5px solid #f1f1f1; margin: 0 0 10px; -webkit-transition: border .2s linear; transition: border .2s linear; }     .lead-thumb a:hover, .lead-thumb a:active { -webkit-transition: border .2s linear; transition: border .2s linear; }          /***** Home Page Blog Content *****/     .home-blog { position: relative; width: 600px; margin: 0 10px; border-top: 1px solid #d9d9d9; border-right: 1px solid #d9d9d9; border-left: 1px solid #d9d9d9; padding: 10px 9px;  }     .home-blog-thumb { position: relative; width: 130px; height: 130px; float: left; background: #f1f1f1; border: 1px solid #d9d9d9; padding: 4px; }     .home-blog-thumb:hover { border-color: #bbb; }     .home-blog-thumb .play-button { position: absolute; top: 30px; left: 30px; }     .home-blog-text { position: relative; width: 440px; float: right; }     .home-blog-text h3 a, .home-blog-text h3 a:visited { color: #464646; font-size: 1.8em; line-height: 1.2em; text-decoration: none; letter-spacing: -.02em; }     .home-blog-text p { font-size: 1.2em; line-height: 1.6em; margin: 10px 0 0; }     .home-blog-text p a, .home-blog-text p a:visited { text-decoration: none; }     .home-blog-text p a:hover, .home-blog-text p a:active { text-decoration: underline; }     .home-blog-cat { position: relative; width: 620px; height: 35px; margin: 0 10px 20px; background: url(images/backgrounds/bg-home-cat.jpg) no-repeat 0 0; }     .home-blog-cat p { line-height: 35px; font-size: 1.1em; background: url(images/backgrounds/bg-cat-links.jpg) no-repeat top right; padding: 0 15px 0 10px; color: #fff; display: inline-block; }     .home-blog-cat p a, .home-blog-cat p a:visited { color: #fff; text-decoration: none; }     .home-blog-cat p a:hover, .home-blog-cat p a:active { text-decoration: underline; }          /***** Breadcrumbs *****/     #breadcrumbs { position: relative; width: 620px; margin: 0 10px 20px; }     #breadcrumbs p { font-size: 1.1em; line-height: 1.4em; }     #breadcrumbs p a, #breadcrumbs p a:visited { font-weight: normal; text-decoration: none; }     #breadcrumbs p a:hover, #breadcrumbs p a:active { text-decoration: underline; }     #breadcrumbs p span.current-crumb { font-weight: bold; }          /***** Page Titles *****/     #page-title, #page-title-wide { position: relative; margin: 0 10px 20px; background: url(images/backgrounds/divider.png) no-repeat bottom center; padding: 0 0 20px; }     #page-title { width: 620px; }     #page-title-wide { width: 940px; }     #page-title h1, #page-title-wide h1 { color: #222; font: 3em/1.2 'VollkornRegular', serif; letter-spacing: -.03em; }          /***** Post Header *****/     #post-header { position: relative; width: 618px; margin: 0 10px 20px; background: #f1f1f1; border: 1px solid #d9d9d9; padding: 10px 0 0; overflow: hidden; }     #post-header-wide { position: relative; width: 618px; margin: 0 10px 20px; background: #f1f1f1; border: 1px solid #d9d9d9; padding: 10px 0 0; }     .post-title { position: relative; width: 618px; }     .header-gravatar { position: relative; width: 80px; height: 60px; float: left; background: url(images/backgrounds/bg-header-avatar.gif) no-repeat right 10px; margin: 0 0 0 9px; z-index: 2; }     .header-gravatar img { display: block; border: 5px solid #fff; }     .header-title { position: relative; background: #fff; border: 1px solid #d9d9d9; padding: 10px; }     #post-header .header-title { width: 498px; float: left; margin: 0 0 0 -1px; }     #post-header-wide .header-title { width: 576px; margin: 0 0 0 9px; }     .header-title h1 { color: #222; font: 2.5em/1.2 'VollkornRegular', serif; letter-spacing: -.03em; }     #post-data { position: relative; width: 618px; margin: 10px 0 0; }     #post-data-wide { position: relative; width: 525; margin: 0 10px 0 0; float: left; }     #post-comments { position: relative; width: 75px; margin: 0 0 0 10px; float: right; }          /***** Post Data *****/     #post-data p { font-size: 1.1em; line-height: 1.4em; color: #222; background: url(images/backgrounds/bg-post-header.gif) repeat-x left top; padding: 10px; }     #post-data p a, #post-data p a:visited { text-decoration: none; }     #post-data p a:hover, #post-data p a:active { text-decoration: underline; }          /***** Share Post Actions *****/     .share-actions { position: relative; width: 140px; margin: 0 0 0 10px; }     .share-actions li { border-right: 1px solid #d9d9d9; border-bottom: 1px solid #d9d9d9; border-left: 1px solid #d9d9d9; padding: 15px 20px; text-align: center; }     .share-button, .share-button:visited { display: inline-block; line-height: 2em; text-align: center; background: #e5e5e5 url(images/backgrounds/bg-button.png) repeat-x 0 0; padding: 0 10px; border: 1px solid #d9d9d9; -moz-border-radius: 5px; -webkit-border-radius: 5px; border-radius: 5px; color: #464646; font-weight: bold; font-size: 1.1em; text-decoration: none; }     .share-button:hover, .share-button:active { border-color: #b9b9b9; }     .post-left-column .widget-head { margin: 0 10px; line-height: 30px; text-align: center; }     .post-left-column p { margin: 0 10px 20px; text-align: center; }          /***** Post Lead Image *****/     #lead-image { position: relative; width: 610px; height: 320px; margin: 0 10px 20px; padding: 5px; background: url(images/backgrounds/bg-postthumb.gif); }     #lead-image img { display: block; }                    /***** Post Meta *****/     .published { position: relative; width: 620px; margin: 0 10px 20px; background: url(images/backgrounds/bg-published.gif) repeat-x 0 0; text-align: center; }     .published p { background: #fff url(images/backgrounds/bg-published-decoration.gif) no-repeat center bottom; display: inline-block; color: #222; font: 1.2em 'VollkornItalic', serif; padding: 0 10px 20px; }     .published p a, .published p a:visited { text-decoration: none; }     .published p a:hover, .published p a:active { text-decoration: underline; }          /***** Post YouTube Video Player *****/     #video-player { position: relative; width: 620px; margin: 0 10px 20px; }     .yt-player { width: 615px; height: 370px; }          /***** Post Entry *****/     .post-columns { position: relative; width: 640px; }     .post-460 { position: relative; width: 460px; margin: 0 10px; float: right; }     .post-620, .periodic-password-post { position: relative; width: 620px; margin: 0 10px; }     .post-940 { width: 940px; margin: 0 10px; }     .post-left-column { position: relative; width: 160px; float: left; margin: 0 0 20px; }     .post-entry { position: relative; }     .post-entry h1, .post-entry h2, .post-entry h3, .post-entry h4, .post-entry h5, .post-entry h6 { margin: 0 0 10px; color: #222; line-height: 1.7; }     .post-entry h1 { font-size: 2.1em; }     .post-entry h2 { font-size: 1.9em; }     .post-entry h3 { font-size: 1.7em; }     .post-entry h4 { font-size: 1.5em; }     .post-entry h5 { font-size: 1.3em; }     .post-entry h6 { font-size: 1.2em; }     .post-entry p { font-size: 1.3em; line-height: 1.7em; margin: 0 0 30px; }     .post-entry blockquote { margin: 0 40px; border-left: 3px solid #464646; padding: 0 0 0 20px; font: 120% 'VollkornItalic', serif; color: #222; }     .post-entry blockquote p { line-height: 1.5em; }     .post-entry ul, .post-entry ol { margin: 0 40px 30px; font-size: 1.3em; line-height: 1.7em; }     .post-entry ul { list-style: disc; }     .post-entry ul ul { margin: 0 0 0 30px; font-size: inherit; list-style: circle; }     .post-entry ul ol { margin: 0 0 0 30px; font-size: inherit; }     .post-entry ul ul li { background: none; padding: 0; }     .post-entry ol { list-style: decimal; }     .post-entry dl { font-size: 1.3em; line-height: 1.7em; }     .post-entry dt { color: #222; font-weight: bold; }     .post-entry dd { margin: 0 0 30px; }     .post-entry code { font: 90% Monaco, Courier, monospace; background: #f1f1f1; padding: 2px; border-bottom: 1px solid #d9d9d9; border-right: 1px solid #d9d9d9; }     .post-entry p a, .post-entry li a,     .post-entry p a:visited, .post-entry li a:visited { text-decoration: none; }     .post-entry p a:hover, .post-entry li a:hover,     .post-entry p a:active, .post-entry li a:active { text-decoration: underline; }     .post-entry table { width: 90%; border-left: 1px solid #d9d9d9; margin: 0 auto 20px; }     .post-entry table caption { line-height: 3em; font-size: 1.2em; font-weight: bold; color: #464646; }     .post-entry table thead, .post-entry table tfoot { background: #f1f1f1; }     .post-entry table th, .post-entry table td { padding: 10px 15px; text-align: left; border-right: 1px solid #d9d9d9; border-bottom: 1px solid #d9d9d9; font-size: 1.2em; color: #464646; }     .post-entry tfoot td { text-align: center; }     .post-entry table th { border-top: 1px solid #d9d9d9; font-weight: bold; }     .post-entry table td a, .post-entry table td a:visited { font-weight: bold; text-decoration: none; }     .post-entry table td a:hover, .post-entry table td a:active { text-decoration: underline; }     .post-entry pre { font-size: 1.4em; background: url(images/backgrounds/bg-pre.gif) top left; line-height: 2.3em; width: 600px; overflow: auto; overflow-y: hidden; border: 1px solid #d9d9d9; margin: 0 0 20px; }     .post-entry pre code { background: none; border: none; font-size: inherit; margin: 0 20px; padding: 18px 0; }     .post-entry address { font-style: normal; font-size: 1.3em; line-height: 1.5em; margin: 0 0 20px; }     .post-entry strong { color: #464646; }          /***** Post Entry Password Form ****/     .post-entry form label { font-weight: bold; }     .post-entry form input[type='password'] { width: 280px; padding: 7px 10px; border: 5px solid #f1f1f1; color: #d9d9d9; margin: 5px 0 0; }     .post-entry form input[type='password']:focus { color: #797979; }     .post-entry form input[type='submit'] { width: 140px; height: 40px; margin: 0 0 20px; background: url(images/backgrounds/periodic-sprite-03.png) no-repeat 0 -340px; font-weight: bold; font-family: Arial, "Helvetia Neue", Helvetica, sans-serif; text-transform: uppercase; color: #797979; margin: 10px 0 0; }     .post-entry form input[type='submit']:hover { background-position: 0 -430px; cursor: pointer; }          /***** Shortcodes *****/     .post-entry blockquote.pullquote { margin: 0 20px; padding: 0; width: 35%; border: none; color: #464646; }     .post-entry blockquote.pullquote p { margin: 0; }     .post-entry blockquote.pullright { padding: 5px 0 5px 20px; border-left: 3px solid #464646; }     .post-entry blockquote.pullleft { padding: 5px 20px 5px 0; border-right: 3px solid #464646; text-align: right; }     .checklist { position: relative; }     .checklist ul { list-style: none; }     .checklist li { background: url(images/backgrounds/check.png) no-repeat left .4em; padding: 0 0 0 20px; }     .arrowlist { position: relative; }     .arrowlist ul { list-style: none; }     .arrowlist li { background: url(images/backgrounds/list-arrow.png) no-repeat 0 .4em; padding: 0 0 0 15px; }     .arrowlist li li { background: none; padding: 0; }     .note { position: relative; width: 75%; margin: 0 auto 30px; background: #f1f1f1; border: 1px solid #d9d9d9; padding: 10px 20px 14px; }     .note p { margin: 0; font: 1.4em/1.6em 'VollkornItalic', serif; }     .two_column { position: relative; width: 47%; margin: 0 20px 0 0; float: left; }     .two_column_last { position: relative; width: 47%; margin: 0; float: left; }     .three_column { position: relative; width: 31%; margin: 0 20px 0 0; float: left; }     .three_column_last { position: relative; width: 31%; margin: 0; float: left; }     .four_column { position: relative; width: 23%; margin: 0 20px 0 0; float: left; }     .four_column_last { position: relative; width: 23%; margin: 0; float: left; }     .button, .button:visited { display: inline-block; line-height: 2.5em; text-align: center; background: #e5e5e5 url(images/backgrounds/bg-button.png) repeat-x 0 0; padding: 0 25px; border: 5px solid #d9d9d9; -moz-border-radius: 20px; -webkit-border-radius: 20px; border-radius: 20px; margin: 0 0 20px; color: #464646; font-weight: bold; font-size: 1.2em; text-decoration: none; }     .button:hover, .button:active { background-color: #fcfcfc; background-position: 0 -40px; border-color: #b9b9b9; }          /***** Post Images *****/     img.alignleft { margin: 0 20px 10px 0; }     img.alignright { margin: 0 0 10px 20px; }     img.aligncenter { margin: 0 auto; }          /***** Post Images with Captions *****/     .wp-caption { background: #f3f3f3; border: 1px solid #d9d9d9; padding: 4px 0; }     .wp-caption img { display: block; margin: 0 auto; }     .wp-caption .wp-caption-text { text-align: center; margin: 5px 0 3px; line-height: 1; font: 1.2em/1.3 'VollkornItalic', serif; color: #464646; }     div.alignleft { margin: 0 20px 10px 0; }     div.alignright { margin: 0 0 10px 20px; }     div.aligncenter { margin: 0 auto 20px; }          /***** Post Image Galleries *****/     .gallery { margin: 0 0 20px !important; }     .gallery-item img { border: 1px solid #d9d9d9 !important; background: #f1f1f1; padding: 4px; }     .post-entry dd.gallery-caption { margin: 0 0 15px; padding: 0 20px; }     .post-entry dd.wp-caption-text { font-family: 'VollkornItalic', serif; color: #464646; line-height: 1.2em; }          /***** Post Share *****/     #post-share { position: relative; width: 620px; margin: 0 10px 20px; }     #post-share li { line-height: 0; float: left; margin: 0 30px 0 0; }          /***** Author Box *****/     .post-gravatar { position: relative; width: 60px; height: 60px; margin: 0 10px 0 0; float: left; }     .post-gravatar img { display: block; width: 50px; height: 50px; border: 1px solid #d9d9d9; background: #fcfcfc; padding: 4px; }     #author-box, #archived-author-box { position: relative; width: 598px; margin: 0 10px 20px; background: #f1f1f1; border: 1px solid #d9d9d9; padding: 10px; }     #author-box h3 { color: #222; font-size: 1.1em; margin: 0 0 10px; text-transform: uppercase; }     #author-text, #archived-author-text { position: relative; width: 528px; float: right; }     #author-text p { font-size: 1.2em; line-height: 1.6em; margin: 0 0 10px; }     #archived-author-text p { font-size: 1.2em; line-height: 1.6em; }     #author-text p a, #author-text p a:visited,     #archived-author-text p a, #archived-author-text p a:visited { text-decoration: none; }     #author-text p a:hover, #author-text p a:active,     #archived-author-text p a:hover, #archived-author-text p a:active { text-decoration: underline; }          /***** Post Archives *****/     #archived-posts { position: relative; width: 640px; }     #archived-posts .widget-head { margin: 0 11px 0 10px; border-bottom: none; }     #archived-posts ul { width: 618px; border-top: 1px solid #d9d9d9; border-left: 1px solid #d9d9d9; margin: 0 10px; }     #archived-posts li { line-height: 0; width: 308px; border-bottom: 1px solid #d9d9d9; border-right: 1px solid #d9d9d9; padding: 20px 0; float: left; }     #archived-posts li.no-articles { border: none; font: 1.4em/1.6em 'VollkornItalic', serif; background: #fff; width: 100%; margin: 0 0 0 -1px; }     .post-archive { position: relative; width: 300px; margin: 0 10px; padding: 20px 0; }     #archived-posts .post-archive { padding: 0; width: 280px; margin: 0 auto; }     #archived-posts .archive-thumb { width: 280px; }     #archived-posts .archive-thumb .hot-topic { left: 5px; bottom: 5px; }     .archive-thumb { position: relative; width: 300px; }     .archive-thumb a, .archive-thumb a:visited { display: block; width: 270px; height: 120px; border: 5px solid #f1f1f1; margin: 0 0 10px; -webkit-transition: border .2s linear; transition: border .2s linear; }     .archive-thumb a:hover, .archive-thumb a:active { -webkit-transition: border .2s linear; transition: border .2s linear; }     .video-archive-thumb .yt-thumb, .video-archive-thumb .attachment-thumbnail-archive { display: block; border: 5px solid #f1f1f1; margin: 0 0 10px; }     .archive-text, .callout-archive-text { position: relative; padding: 0 5px; }     #recent-articles .archive-text { width: 195px; margin: 0 5px 0 0; float: right; padding: 0; }     .archive-text h3 a, .archive-text h3 a:visited,     .archive-text h4 a, .archive-text h4 a:visited { color: #464646; text-decoration: none; font-size: 1.2em; line-height: 1.6em; -webkit-transition: color .2s linear; transition: color .2s linear; }     .archive-text h3 a:hover, .archive-text h3 a:active,     .archive-text h4 a:hover, .archive-text h4 a:active { -webkit-transition: color .2s linear; transition: color .2s linear; }     .archive-text p { margin: 10px 0 0; font-size: 1.2em; line-height: 1.6em; }     .archive-text .meta-data { font-size: 1.1em; line-height: 1.6em; }     .archive-text p a, .archive-text p a:visited { text-decoration: none; }     .archive-text p a:hover, .archive-text p a:active { text-decoration: underline; }     .play-archive { position: absolute; top: -110px; left: 110px; border: none !important; }     #archive-error { position: relative; width: 620px; margin: 0 10px 20px; border-top: 1px solid #d9d9d9; padding: 20px 0 0; }     #category-description { position: relative; width: 620px; margin: 0 10px 20px; }     #category-description p { font: 1.4em/1.6em 'VollkornItalic', serif; }          /***** Related Posts *****/     .rel-post { position: relative; width: 280px; margin: 0 auto; }     .rel-post-text { position: relative; width: 200px; float: right; }     .rel-post-text h4 a, .rel-post-text h4 a:visited { color: #464646; text-decoration: none; font-size: 1.1em; line-height: 1.3em; -webkit-transition: color .2s linear; transition: color .2s linear; font-weight: normal;  }     .rel-post-text h4 a:hover, .rel-post-text h4 a:active { -webkit-transition: color .2s linear; transition: color .2s linear; }     .rel-post-text p { margin: 5px 0 0; font-size: 1.1em; line-height: 1.3em; }     .rel-post-text p a, .rel-post-text p a:visited { text-decoration: none; }     .rel-post-text p a:hover, .rel-post-text p a:active { text-decoration: underline; }     .related { margin: 0 0 20px; }               /***** Contributors Page *****/     .contributors-list { position: relative; width: 620px; margin: 0 10px; }     .contributors-list li { overflow: hidden; padding: 10px; border: 1px solid #d9d9d9; margin: 0 0 20px; }     .contribute-avatar { position: relative; width: 85px; height: 85px; float: left; }     .contribute-text { position: relative; width: 493px; float: right; }     .contribute-avatar a, .contribute-avatar a:visited { display: block; width: 75px; height: 75px; border: 5px solid #f1f1f1; -webkit-transition: border .2s linear; transition: border .2s linear; }     .contribute-avatar a:hover, .contribute-avatar a:active { -webkit-transition: border .2s linear; transition: border .2s linear; }     .contribute-text h3 a, .contribute-text h3 a:visited { font-size: 1.4em; line-height: 1.5em; color: #464646; text-decoration: none; -webkit-transition: color .2s linear; transition: color .2s linear; }     .contribute-text h3 a:hover, .contribute-text h3 a:active { -webkit-transition: color .2s linear; transition: color .2s linear; }     .contribute-text p { font-size: 1.2em; line-height: 1.5em; margin: 10px 0 0; }     .contribute-text p a, .contribute-text p a:visited { text-decoration: none; }     .contribute-text p a:hover, .contribute-text p a:active { text-decoration: underline; }          /***** Form Elements *****/     .form-wrapper { position: relative; width: 620px; margin: 0 0 20px; }     .form-wrapper p { font-size: 1.2em; line-height: 1.5em; margin: 0 0 20px; }     .form-wrapper p a, .form-wrapper p a:visited { text-decoration: none; }     .form-wrapper p a:hover, .form-wrapper p a:active { text-decoration: underline; }     .form-wrapper p code { font: 90% Monaco, Courier, monospace; }     .form-field-wrapper { position: relative; display: block; margin: 0 0 20px; }     .form-wrapper label, .wpcf7 label { display: block; font-size: 1.1em; line-height: 1; font-weight: bold; text-transform: uppercase; margin: 0 0 5px; }     .form-wrapper label em, .wpcf7 label em { font-style: normal; }     .text-input { width: 280px; padding: 7px 10px; border: 5px solid #f1f1f1; font: 1.35em/1 "Helvetica Neue", Helvetica, Arial, sans-serif; color: #d9d9d9; }     .text-input:focus { color: #797979; }     .textarea-input { width: 520px; height: 250px; border: 5px solid #f1f1f1; font: 1.35em/1.5em "Helvetica Neue", Helvetica, Arial, sans-serif; color: #d9d9d9; padding: 7px 10px; overflow: auto; }     .textarea-input:focus { color: #797979; }     .form-submit { width: 140px; height: 40px; margin: 0 0 20px; background: url(images/backgrounds/periodic-sprite-03.png) no-repeat 0 -340px; font: bold 1.1em/1 "Helvetica Neue", Helvetica, Arial, sans-serif; text-transform: uppercase; color: #797979; margin: 0 0 0 410px; }     .wpcf7 .form-submit { font-size: inherit; }     .form-submit:hover { background-position: 0 -430px; cursor: pointer; }          /***** Misc *****/     .right-arrow { padding: 0 9px 0 0; }     .scroll-top { display: block; width: 40px; height: 40px; text-indent: -9999px; background: url(images/backgrounds/periodic-sprite-03.png) no-repeat 0 -520px; }     .scroll-top:hover { background-position: 0 -610px; }     .rss { background: url(images/backgrounds/periodic-sprite.png) no-repeat 0 -658px; padding: 1px 0 2px 21px; }     .last { margin: 0 !important; }     .play-button { display: block; width: 70px; height: 70px; text-indent: -9999px; background: url(images/backgrounds/periodic-sprite-03.png) no-repeat 0 0; }     .play-button:hover { background-position: 0 -120px; }     .error-message { font-size: 1.2em; }     .divider { border-bottom: 1px solid #d9d9d9; }     .meta-info { font: 1.1em/1 'VollkornItalic', serif; display: block; color: #a5a5a5; margin: 5px 0 0 15px; }          /***** Post & Page Pagination *****/     .post-pager { border-top: 1px solid #d9d9d9; font-family: 'VollkornItalic', serif; color: #222; padding: 10px 0 0; font-size: 1.4em !important; }     .post-pager span { margin: 0 5px 0 0; }     .post-pager a { margin: 0 5px; }


Remove WordPress default registration client side validation?

Is there a way to remove/disable WordPress default registration client side validation? I dislike the pop alert and would like to add my own client side validation visual to users. Please assist me and thank you. **Update**               (function($) {          window.onload = function() {         var form = document.getElementById('s2member-pro-paypal-registration-form');         form.onsubmit = function() {             cValidate();         }     }          function cValidate() {         var valid = true;         var content = document.getElementById('form-errors');         var msg = "Please correct the following errors:
";              var elements = [             document.getElementById('s2member-pro-paypal-registration-first-name'),             document.getElementById('s2member-pro-paypal-registration-last-name'),             document.getElementById('s2member-pro-paypal-registration-email'),             document.getElementById('s2member-pro-paypal-registration-username'),             document.getElementById('s2member-pro-paypal-registration-password1'),             document.getElementById('s2member-pro-paypal-registration-password2'),             document.getElementById('s2member-pro-paypal-registration-custom-reg-field-salutation-id'),             document.getElementById('s2member-pro-paypal-registration-custom-reg-field-job-title'),             document.getElementById('s2member-pro-paypal-registration-custom-reg-field-functional-role'),             document.getElementById('s2member-pro-paypal-registration-custom-reg-field-department-field'),             document.getElementById('s2member-pro-paypal-registration-custom-reg-field-direct-phone'),             document.getElementById('s2member-pro-paypal-registration-custom-reg-field-company-name'),             document.getElementById('s2member-pro-paypal-registration-custom-reg-field-street-address'),             document.getElementById('s2member-pro-paypal-registration-custom-reg-field-city-id'),             document.getElementById('s2member-pro-paypal-registration-custom-reg-field-zcode-id'),             document.getElementById('s2member-pro-paypal-registration-custom-reg-field-state-id'),             document.getElementById('s2member-pro-paypal-registration-custom-reg-field-country-id'),             document.getElementById('s2member-pro-paypal-registration-custom-reg-field-industry-id'),             document.getElementById('s2member-pro-paypal-registration-custom-reg-field-company-website'),             document.getElementById('recaptcha_response_field')         ];              if (elements[0].value == "") {             msg += "First name field is empty.
";             content.innerHTML = msg;         }         if (elements[1].value == "") {             msg += "Last name field is empty.
";             content.innerHTML = msg;         }         if (elements[2].value == "") {             msg += "Email field is empty.
";             content.innerHTML = msg;         }         if (elements[3].value == "") {             msg += "Username field is empty.
";             content.innerHTML = msg;         }         if (elements[4].value == "") {             msg += "Password name field is empty.
";             content.innerHTML = msg;         }         if (elements[5].value == "") {             msg += "Re-enter Password field field is empty.
";             content.innerHTML = msg;         }          }          })(jQuery);


Configure paragraph style without editing CSS

Is there a way to change the default text paragraph style in WP without changing CSS by hand? I.e. I need GUI for that. In particular, I want to configure padding height between paragraphs.


PHP 5.5, w3 Total Cache, and opcache

PHP5.5 has ZendOptimizer opcache built in and it seems to work pretty well and the benchmarks seem to give it a slight edge over APC in performance. Great. So APC seems to be on its way out. My question regards w3 total cache. W3TC has the option to do database and opcode caching using APC, and I had this working more or less fine with the APCu (APC user cache). Its compatibility with opcache wasn't perfect -- for example, you'd get some weird save issues if you didn't make some tweaks to cache invalidation and so forth. I'm wondering -- is it worth it at all to use APCu for user stored caches for opcache/dbcache? I turned it off and my CPU load seems a little lower and I'm wondering if I'm really accomplishing anything given that Zend opcache is already doing the heavy lifting (is it?). I prefer the more vanilla install (no APCu) as it's one less thing to worry about. But I wonder if I'm really losing any performance. Thoughts?


Display all images except those uploaded via OptionTree

I'm using the following to display all images in media library however, I'd like to exclude images uploaded via OptionTree as these are either banners or logos.               $args = array(             'post_type' => 'attachment',             'post_status' => 'published',             'posts_per_page' =>6,             'numberposts' => null,             'post_mime_type' =>'image',             'orderby' => 'rand',             'exclude'   => $my_meta_box,         );              $attachments = get_posts($args);              $post_count = count ($attachments);              if ($attachments) {         foreach ($attachments as $attachment) {         $img = wp_get_attachment_url($attachment->ID);         echo '<img class="footer-img" src="'.$img.'">';         }            }      Thanks!


Setting up SVN for teamwork on WordPress custom theme development

Amongst technical devs, it's pretty straightforward to get everyone running their own local dev server, get TortoiseSVN running, and then commit changes periodically to the repository. We can then update the version of the test site on the shared server from this repo and everyone is happy. Except the designers who are just scratching their heads. Since the designers do not have their own local development server, in order for them to preview their HTML, PHP and CSS changes to the theme, they have to upload those changes to the in-house development server, which they all share access to. Adobe's DreamWeaver provides simple file lock protection to avoid edit collisions, but that's where it ends. I would love a solution that allows them to use TortoiseSVN or DreamWeaver 6 (CS4)'s built in Subversion support. But I can't see how this would work. They would basically have to "commit" every single minute edit in order to preview it on the dev server, and this of course defeats the purpose of version control. Has anyone found a workaround for this? Is the only solution to set them all up with local webservers?


Custom query: how to get the sticky posts first?

I noticed that if I code a custom WP_Query, sticky posts don't show first in the list. So I was wandering how to achieve that. I've almost done it with 3 subsequent queries, but I guess there must be a more elegant solution for this. One thing I thinked involved at least 2 query:   * first build a simple function to reuse just to output html   * second make a query of only stiky posts, and output the html (according to a preset max items)   * third, is there's still room for new items according to max items, make a query excluding the sticky posts, and again, output html. So, it all would start like this (and then go on..):                           $max_items = 5;             $sticky_ids = get_option('sticky_posts');                  if(count($sticky_ids) != 0){                 //query degli sticky                 $sticky_soon_query = new WP_Query();                 $sticky_soon_query->query(array(                     'category_name' => 'coming-soon',                     'posts_per_page' => $max_items,                     'post__in' => $sticky_ids                 ));             }       Is there any more elegant solution?


Display metabox title for custom fields with values

I'm using multiple metabox panels in my write posts. IN my functions I'm registering multiple metaboxes:               $prefix = 'dbt_';          $meta_boxes = array();          $meta_boxes[] = array(         'id' => 'general_information',         'title' => 'General Information',         'pages' => array('post', 'page', 'link'), // multiple post types, accept custom post types         'context' => 'normal', // normal, advanced, side (optional)         'priority' => 'high', // high, low (optional)         'fields' => array(             array(                 'name' => 'Name',                 'id' => $prefix . 'name',                 'type' => 'text',                 'std' => 'default value here'             ),             array(                 'name' => 'Manufacturer',                 'id' => $prefix . 'manufacturer',                 'type' => 'text',                 'std' => ''             )          $meta_boxes[] = array(         'id' => 'measurements',         'title' => 'Measurements',         'pages' => array('post', 'page', 'link'), // multiple post types, accept custom post types         'context' => 'normal', // normal, advanced, side (optional)         'priority' => 'high', // high, low (optional)         'fields' => array(             array(                 'name' => 'Length',                 'id' => $prefix . 'length',                 'type' => 'text',                 'std' => ''             ),             array(                 'name' => 'Width',                 'id' => $prefix . 'width',                 'type' => 'text',                 'std' => ''             )          ..etc      In my theme I'm displaying the name and values of each field in each metabox group. The goal is to have fields grouped by metaboxes otherwise I would just use `get_post_custom($post_id)`. Code in single.php:               global $meta_boxes;          foreach ( $meta_boxes as $metabox ) {     echo $metabox['title'];       foreach ( $metabox['fields'] as $field ) {         $meta = get_post_meta($post->ID, $field['id'], true); //get post meta from each metabox         if(!isset($meta[0])) continue; //display only fields with values         echo $field['name'];         echo $meta ? $meta : $field['std']; //show value or default value       }     }      If for instance a metabox has no fields with values, the metabox title `$metabox['title']` still appears. How can I hide the metabox title if no values exists?


A better way to get stats

I'm not looking for an specific answer but more of a general direction. Recently I decided to make my own stats plugin. I know there are tons out there, but I wanted to make my own. I figured, how hard can it be? Just create a table, log the IP, and on every page refresh, store data in a table. The problem I'm having is that the stats seem to be too high. I've deployed my plugin on a test batch of sites with PR of ~ 1, and the plugin is showing thousands of visits, and I know there aren't that many uniques coming. Here's the entire plugin: https://gist.github.com/1469300 Here's my process visitor function.               /**       * Process visitor      *       * Checks whether used is "logged" or not,       * Adds the user to the unique table if not logged,      * adds a hit using the user_id if she is logged      *      */     function vsp_process_visitor() {          global $wpdb;          $visits_table = $wpdb->prefix . "vsp_visits";              if ( vsp_visitor_logged_in() ) {              vsp_update_count();          }              if ( !vsp_visitor_logged_in() ) {             vsp_new_record( $visits_table );          }     }      Here's the check to see if the session is set or not.               /**       * Checks user state      *       * Checks whether a user session is set      * Logged in if set      *      */     function vsp_visitor_logged_in() {          $logged_in = false;          if ( isset( $_SESSION[ 'vsp_user' ] ) ) {              $logged_in = true;          }         return $logged_in;      }      Here's the function that inserts data.               /**       * Creates new unique and hit      *       * Inserts data into the unique table and the       * hits table, if allowed.       *      */     function vsp_new_record( $table ) {          $ip = get_ip();          global $wpdb;          $hits_table = $wpdb->prefix . "vsp_hits";              /*              Insert data into the visitors table          */              $data = array ( 'ip' => $ip );              if ( valid_time($table) ) {                  $wpdb->insert ( $table, $data );              }             $userID = $wpdb->get_var( 'select `id` from ' . $table . ' where `ip` = "' . $ip . '" order by `id` desc limit 1;');             $_SESSION[ 'vsp_user' ] = $userID;                   /*              Insert data into the hits table         */                  $data = array( 'visit_id' => $userID );             if ( valid_time($hits_table) ) {                  $wpdb->insert ( $hits_table, $data );              }            }      The code is executed at a refresh. My question is, when a search robot visits my website, will it "trigger" a page refresh, and create a table in my stats database, skewing my results. ## App Logic A user comes to the site Question: Is the session set? If no, then create a session with user's IP, and add a hit and unique If yes, then add a hit with user's IP Am I missing something else?


Why does WordPress add 0 (zero) to an Ajax response?

Unless I end Ajax processing function by `exit()` or `die()`, the Ajax function receives desired and correct output but following by `0`. Any idea why is that happening? Is that meant to be like that or it could be fixed?               add_action('wp_ajax_get_homepage', 'get_homepage');     add_action('wp_ajax_nopriv_get_homepage', 'get_homepage');          function get_homepage(){         echo "get_homepage ->";         exit();     }      I've read at AJAX in Plugins, but why is that necessary?


Front-End Editor email notification issue

I'm trying to send a notification email when a user updates a page/post, either in the backend or by using the Front-End Editor. It works fine when updating in the backend but no data is emailed through when updating with the Front-End Editor. Anybody have any ideas on this please?               function __test_on_publish( $post )     {        global $post;     if( ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) || $post->post_status == 'auto-draft' )     return;          if ( !wp_is_post_revision( $post ) )  {         $post_title = get_the_title( $post );          $post_url = get_permalink( $post );          $aid = $post->post_author;         $user_email = get_the_author_meta('user_nicename', $aid);                $subject = 'A page has been updated';          $message = "A page has been updated on " . get_bloginfo( 'name' ). " by ".$user_email."\n\n";          $message .= $post_title. "\n\nView it: " . get_permalink( $post ) . "\n\nEdit it: " . get_edit_post_link( $post ). "\n\n";          //send email to admin               wp_mail( get_option( 'admin_email' ), $subject, $message );           }           }     add_action( 'pre_post_update', '__test_on_publish', 10, 3 );      **Edit:** I ended up adding some wp_mail functionality directly into the post.php file of Front-end Editor which seems to work well, (see below).                   function save( $data, $content ) {                /--- some original code omitted ---/              wp_update_post( (object) $postdata );              //// added ////         $post_title = get_the_title( $post_id );                 $post_tmp = get_post( $post_id );         $aid = $post_tmp->post_author;         $user_email = get_the_author_meta('user_nicename', $aid);                    $subject = 'A page has been updated by '.$user_email;          $message = "A page has been updated on " . get_bloginfo( 'name' ). " by ".$user_email."\n\n";          $message .= $post_title. "\n\nView it: " . get_permalink( $post_id ) . "\n\nEdit it: " . get_edit_post_link( $post_id ). "\n\n";          wp_mail( get_option( 'admin_email' ), $subject, $message );          }


search does not yield access restricted results

If the user is logged out and tries to search something, he is redirected to the login page. How is it possible to have the search always show all of the results (including the excerpts and the image), even if the user is logged out and the resulting pages/posts are restricted to members only? I tried using the plugin "WordPress Access Control", but that did not help.


Redirecting sub-domain to main domain has incorrect URL on subsequent pages

I just redirected my sub-domain, _www.simco-apts.com/testsite_ to takeover my main domain, _www.simco-apts.com_. While this works for the homepage, all other links/pages contained within the site add _/testsite_ back into the URL when clicked. My Hosting went into the wp-config.php file and changed the WP URL and Site URL. Now, if I remove _/testsite_ from the WordPress Address URL, my pages open without _/testsite_ in the URL but the page is blank. From everything I've read, the steps I took were correct to redirect the site. I even installed a plugin to try to redirect the pages and it works, but the pages are blank. What am I missing?


Adding custom fields to the Quick Edit screen - puzzled about the column concept

We've been told that: > The `quick_edit_custom_box` action hook will not fire unless there are > custom columns present. (Source^) If so, then adding a custom field edit functionality to the Quick Edit panel needs a Custom Field column first. It's hard to believe for me. Because there are certain fields in the Quick Edit panel that isn't present in any of that posts column, like the **"Make this post sticky"** checkbox. ![Quick Edit Panel](http://i.stack.imgur.com/8z6WP.png) I'm not dealing with any custom post types of custom taxonomy. I just implemented 3 individual custom fields from the Add New Post panel using 3 drop downs: ![Input Box](http://i.stack.imgur.com/FGHeo.png) **Translation:** The free translation of the Bangla texts here says: _You can choose where you want to show the news. Neither of the field is mandatory_. And I queried them three in the Posts List display page with 3 individual query like this:               add_action('manage_posts_custom_column', 'news_column', 10, 2);          function news_column($column_name, $id) {         if ( $column_name == 'news-box' ) {             global $wpdb;             $featuredQuery = 'SELECT meta_value                             FROM ' . $wpdb->prefix . 'postmeta                             WHERE meta_key="featured"                             AND post_id=' . $id;             $scrollQuery = 'SELECT meta_value                             FROM ' . $wpdb->prefix . 'postmeta                             WHERE meta_key="scrollnews"                             AND post_id=' . $id;             $breakingQuery = 'SELECT meta_value                             FROM ' . $wpdb->prefix . 'postmeta                             WHERE meta_key="breakingnews"                             AND post_id=' . $id;                  $resultFeatured = $wpdb->get_results($featuredQuery, ARRAY_A);             $resultScroll = $wpdb->get_results($scrollQuery, ARRAY_A);             $resultBreaking = $wpdb->get_results($breakingQuery, ARRAY_A);             if ( isset($resultFeatured[0]) && ($resultFeatured[0]['meta_value'] == '1')) { ?>                 <img src="<?php echo bloginfo( 'template_url'); ?>/images/icon-1st.png" title="<?php _e( 'শীর্ষ খবর', TEXTDOMAIN) ?>"/>
             <?php }             if ( isset($resultScroll[0]) && ($resultScroll[0]['meta_value'] == '1')) { ?>                 <img src="<?php echo bloginfo( 'template_url'); ?>/images/icon-scroll.png" title="<?php _e( 'তাজা খবর', TEXTDOMAIN) ?>"/>
             <?php }             if ( isset($resultBreaking[0]) && ($resultBreaking[0]['meta_value'] == '1')) { ?>                 <img src="<?php echo bloginfo( 'template_url'); ?>/images/icon-breaking.png" title="<?php _e( 'ব্রেকিং নিউজ', TEXTDOMAIN) ?>"/>             <?php }         }     }      So I made them three visible in a single column to make them a bit sorted out for the admin/editor.   ![post listed custom fields in a single column](http://i.stack.imgur.com/tNrS5.png) In that case:   * If "Sticky Post" checkbox can be enabled without any column, then why not I can add a custom field edit box or checkbox into the Quick Edit column without their individual column?   * Do I have to make their individual column to add them to the Quick Edit screen?


Release Model for Wordpress?

Is there a reference for the wordpress release and version model? In particular   * When a new release like 3.6 comes out, will 3.5 have security fixes for a period of time?   * Are some release more likely to have breaking changes? In other words, will 3.5 to 3.6 break less than something like 3.9 to 4?


Insert posting automatically based in acf field

good day   I found a code that works, but it creates several posts of the same name, do not want that, he wanted to create only once post_type if the value is 'x', but he is creating a 'x' every time updates , how do I create it only once this post_type?      **My Code** :               <?php          wp_insert_post( array(             'post_status' => 'publish',             'post_type' => 'fornecedores', // post_type which is created posting             'post_title' => get_field('fornecedor'), // Custom field to generate the post type             'post_content' => ''         )     )     ?>         Code is in a loop of the post type products.   Understand me?


Changing when mobile menu is displayed

Wordpress seems to be displaying the mobile menu (in Twentythirteen at least) at 643px wide, however i need it to activate at 767px. I cannot seem to be able to find what activates the menu at 643px, it's certainly not in the CSS and i can't seem to find it relating anywhere in the corresponding JS files. Anyone had experience with this in the past?


Pagination on custom page template

I have a page with videos, which are getting from custom plugin which attaches videos to post _(not my work)_ and through loop by posts shows on video page. _(not my work too)_ The page have link like **mysite.com/?page_id=21** I need to make a pagination by 10 videos on page, but I was trying different methods and didn't get any results. The code of page is :               <?php     //Template name: Video gallery     get_header();     ?>

Video

                 <?php                 $posts = get_posts(array( "meta_key" => 'select', "meta_value" => 1, "posts_per_page"=> 10));                 foreach($posts as $post){ setup_postdata($post);                 ?>                       <?php                        $p = get_post($post->post_parent);                         echo "

".$p->post_title."

"; ?>                      <video id="example_video_<?php echo $post->ID;?>" class="video-js vjs-default-skin" controls preload="none" width="420" height="265" style="display: inline-block; margin: 0 8px 0 0px; clear: both;"                       poster="<?  $url = wp_get_attachment_url( get_post_thumbnail_id($post->ID) ); echo $url;?>"                       data-setup="{}">                     <source src="<?php echo (get_post_meta($post->ID, 'videourl', true)); ?>" type='video/mp4' />                     <track kind="captions" src="demo.captions.vtt" srclang="en" label="English"></track>                   </video>                        <?                       $url = $post->guid;                 $exp = explode("/", $url);                 $file_name = end($exp);                       ?>                  <a href="/wp-content/uploads/download.php?file=<?php echo $file_name; ?>" class="button red">Download video
                      <?php } ?>

<?php next_posts_link('«Previous Entries') ?>

<?php previous_posts_link('NextEntries »') ?>

     <?php get_footer();?>      PS sorry if my problem was solved, but I've read more than 30 posts, and didn't get the answer.


Genesis Child Theme Modifying Comments display

I'm using a theme which works with Genesis Framework. The theme is called pinsomo & I'm wondering how to "move" comments count div to the bottom of the post. Here is the demo: [[link has expired]] You see the comment icon next to the title. I want to move it to the heart icon.


add_editor_style is not loading in frontend. Any solution?

This is default wordpress add_editor_style function:               function add_editor_style( $stylesheet = 'editor-style.css' ) {              add_theme_support( 'editor-style' );              if ( ! is_admin() )             return;              global $editor_styles;         $editor_styles = (array) $editor_styles;         $stylesheet    = (array) $stylesheet;         if ( is_rtl() ) {             $rtl_stylesheet = str_replace('.css', '-rtl.css', $stylesheet[0]);             $stylesheet[] = $rtl_stylesheet;         }              $editor_styles = array_merge( $editor_styles, $stylesheet );     }      As you see `if ( ! is_admin() ) return;` is there and basically we cant add custom styles to frontend wp_editor.. What is proper solution for it?


Display count number of posts with the same specific meta_key meta_value

I want to display a list of posts ordered by a specific meta_key. My posts have the following custom fields: `author_lastname` and `author_firstname`. So far, it works good. The posts are displayed correctly. My query is:                       <?             $category = $wp_query->get_queried_object();             $query = new WP_Query(                 array (                     'post_type' => 'post',                     'cat' => $category->cat_ID,                     'posts_per_page' => -1,                     'orderby'   => 'author_lastname',                     'meta_key' => 'author_lastname',                     'meta_key' => 'author_firstname',                     'order' => 'ASC'                 )             );                  if ( $query->have_posts() ) :                 while ( $query->have_posts() ) : $query->the_post(); ?>
<a href="<?php the_permalink(); ?>"><?php echo get_field('author_lastname') . ', ' . get_field('author_firstname') . ' (' . count($query) . ')'; ?>
                 <?                 endwhile;                 wp_reset_query();             endif;             ?>      Now, let's say two posts have the same author (same values in `author_firstname` and `author_lastname`). I will get this result:               Einstein, Albert (1)     Einstein, Albert (1)     Tesla, Nikola (1)      This is not what I want. How could I get this?               Einstein, Albert (2)     Tesla, Nikola (1)      Thank you in advance for your help!


Multisite 404 on pages - rewrite error breaks database

After updating my reading settings on my multisites, I get 404 errors on all my pages. The only way to fix the issue is by reverting the database to previous version, that is the only way it can be fixed. I dont think you get this error if the post type is empty, I think it needs some posts adding to it. After painstaking process of elimination via dropping databases and re uploading a 100 times whilst removing functions one by one, I found the function causing the issue...               // REGISTER POST TYPE INDIVIDUALS     register_post_type(         'individual',array(             'label' => 'Individuals',             'description' => '',             'public' => true,             'show_ui' => true,             'show_in_menu' => true,             'capability_type' => 'post',             'hierarchical' => false,             'rewrite' => array(                 'slug' => ''             ),             'query_var' => true,             'exclude_from_search' => false,             'supports' => array(                 'title','editor','excerpt','trackbacks','custom-fields','comments','revisions','thumbnail','author','page-attributes'             ),             'taxonomies' => array(                 'type'             ),             'labels' => array (                 'name' => 'Individuals',                 'singular_name' => 'Individual',                 'menu_name' => 'Individuals',                 'add_new' => 'Add Individual',                 'add_new_item' => 'Add New Individual',                 'edit' => 'Edit',                 'edit_item' => 'Edit Individual',                 'new_item' => 'New Individual',                 'view' => 'View Individual',                 'view_item' => 'View Individual',                 'search_items' => 'Search Individuals',                 'not_found' => 'No Individuals Found',                 'not_found_in_trash' => 'No Individuals Found in Trash',                 'parent' => 'Parent Individual'             ),             'menu_icon' => get_bloginfo('template_url').'/images/menu_icon.png'         )     );     register_taxonomy('individual-group',array (       0 => 'individual',     ),array( 'hierarchical' => true, 'label' => 'Group Number','show_ui' => true,'query_var' => true,'rewrite' => array('slug' => ''),'singular_label' => 'Group Number') );     register_taxonomy('individual-role',array (       0 => 'individual',     ),array( 'hierarchical' => true, 'label' => 'Role','show_ui' => true,'query_var' => true,'rewrite' => array('slug' => ''),'singular_label' => 'Role') );     register_taxonomy('individual-territory',array (       0 => 'individual',     ),array( 'hierarchical' => true, 'label' => 'Territory','show_ui' => true,'query_var' => true,'rewrite' => array('slug' => ''),'singular_label' => 'Territory') );         My multisite runs absolutely fine, until randomly (possibly because of updating a setting), I get 404 errors on all pages. I can force create the 404 error by updating the reading settings to a static page... http://i.imgur.com/RRqBU1m.png Within the reading panel I can choose any page template, or try to revert "Your Latest Posts" on this page, and the 404 occurs. If you switch to another theme, the 404 error is carried over, but weirdly you just get the home page for every single page - so the problem must be in the db. The only way I get rid of the 404 error is by reseting my database to a previous version before the 404 error has occurred    **This is how i found what was causing it step by step...**   1. I deleted my functions.php contents. And updated my reading settings. The site works fine! No 404 error.   2. I re added my functions.php contents. Still no error.   3. I updated my reading settings to force create the error - and yes, I got the 404.    4. I reset my database, and 404 has gone.   5. I deleted all my function contents, added them one by one, refreshing my website each time. I did NOT get a 404, site works fine.   6. I deleted all my functions again, added them one by one, but each time I added one, I updated my reading settings, and when I add the function below, I got the 404, see below what is causing it...   7. I tested this on its own in twentytwelve theme (with posts added to individual post type) with reset database and the error still occurs.    How can this function be fixed as its prooving to be a nightmare. Thanks in advance.


What is the best way to handle deprecated functions?

Wordpress 3.3 has deprecated the add_contextual_help() functions and it's filters, so in order to continue supporting 3.0 - 3.2.1 and also comply with 3.3, I have done the following:               global $wp_version;     if ($wp_version >= '3.3') {         // New method         add_action("load-$admin_page", 'CrayonSettingsWP::help_screen');     } else {         // Depreciated method         add_filter('contextual_help', 'CrayonSettingsWP::cont_help', 10, 3);     }      Is there a better approach?


How to migrate from wordpress.com to self-hosted wordpress

I'm trying to migrate from wordpress.com to self-hosted wordpress. These are some of the things I've done, but I'm not quite able to migrate successfully.   * Changed my Godaddy account DNS to wordpress   * Through Godaddy Web hosting connection, I installed wordpress application   * From wordpress.com I performed domain mapping ***The site is allenkim.me and it currently works. From here, I decided I want to change it to self-host wordpress and no longer use wordpress.com   * I downloaded wordpress   * Followed the 5 min instruction   * Uploaded wordpress files on my web server PROBLEM when I try to visit allenkim.me/wp-admin/install.php in a web browser, it doesn't open. I'm not sure what the problem is. Any help?


Add item to media library from blob or dataUrl

I'm trying to build a webcam snapshot recorder. It should take a picture and upload it to the WP media library via ajax / async-upload. Already managed to add a view to the media library. Recording also works. I can either store the raw image data in blob or in base 64 encoded string (like data url) How can I put this data into the upload queue? Any suggestion / further reading / well explained reasons why this won't work appreciated. Thanks a lot, joern EDIT: This is my code so far. It   * adds a panel to WP media library.    * displays an image with `src="data:image/`   * Tries to generate a file-like object and put it in the upload queue. (That's where I'm failing)  JS-Dependency: Needs github repo blueimp/JavaScript-Canvas-to-Blob


How can I list posts by author?

How can I list posts as sub-items of authors? It should look like:

Author

Post1

Post2

      I have an array containing author data including `$author->ID`. My function looks like this:               function add_custom_menu_items($items, $args) {              $authors = get_users('role=author');              return $items.$authors_str;         }     add_filter( 'wp_nav_menu_items', 'add_custom_menu_items', 5, 2);      Where can I get a list of posts?


How to get pages of parent (non-recursive)?

I'd like to get all pages that are direct children of HOME_ID. Per http://codex.wordpress.org/Function_Reference/get_pages#Parameters (see 'parent' parameter), I think this should be done with get_pages:               $top_pages = get_pages(array('parent' => HOME_ID, 'sort_column' => 'menu_order'));      but this returns no results. I get results back if I plug in 0 for HOME_ID. No sweat because I can achieve what I want with:               $menu_wp_query = new WP_Query();     $top_pages = $menu_wp_query->query(array('post_type' => 'page', 'post_parent' => HOME_ID, 'orderby' => 'menu_order'));      But still uncomfortable; is this a bug? Using WP 3.2.1 Thanks.


Ways to give a wp_list_pages menu link specific class names?

I'm looking to style my wp_list_pages with a span class. I'd like to give it a unique class so that I can give each a specific icon.               'link_before' => '',      I was thinking of using the page slug but the menu I use also has child pages involved so it would have to pull the target links page slug not the `$post->post_name` one. I'm not sure if it's a good option which just needs better logic or if there's a better solution altogether. Here's my full menu code:               global $post;          if ( is_page() && wap8_has_children( $post->ID ) == '1' || wap8_has_siblings() == '1' ) {           if ( $post->post_parent ) {                $args = array(                'sort_column' => 'menu_order',                'title_li'    => '',                'child_of'    => $post->post_parent,                'echo'        => 1,            'link_before' => 'post_name.'">',           );           } else {                $args = array(                'sort_column' => 'menu_order',                'title_li'    => '',                'child_of'    => $post->ID,                'echo'        => 1,         'link_before' => 'post_name.'">',           );           }           echo "
\n";          wp_list_pages( $args );      echo "
\n";          }      -edit- What I'd like the output to look like.


Where is defined a custom register_taxonomy?

Where is defined a custom register_taxonomy for my website url? Now is showing:               http://localhost:1337/wordpress/portfolio-list/yapbond/      But I want               http://localhost:1337/wordpress/product-list/yapbond/      In which file I change this?


How to Disable UNICODE slug?

I am inserting the post titles in UNICODE, but i dont want to save in unicode UTF8 characters. Instead, i want to use my title convert function before slug auto-creation: like this:               function my_convert($string)     {     $string = str_replace('ჲ','a',$string);     $string = str_replace('ძ','b',$string);     ..............     .............     return $string;     }


Why if i enqueue the tinymce script i get undefined error

<?php      /*     Plugin Name: random plug     Plugin URI: http://example.com/wordpress-plugins/my-plugin     Description: A plugin demonstrating Cron in WordPress     Version: 1.0     Author: Brad Williams     Author URI: http://wrox.com     License: GPLv2     */          add_action('init', 'register_tagging_post');           function register_tagging_post(){            $tagging_args = array(                'public' => true,                'supports' => array(                    'title',                    'thumbnail'                     ),                 'query_var' => 'tagging',                'rewrite' => array(                   'slug' => 'tagging',                   'with_front' => false                ),                 'labels' => array(                 'name' => 'Tagge Albums',                 'singular_name' => 'Album',                 'add_new' => 'Add New Album',                 'add_new_item' => 'Add New Album',                 'edit_item' => 'Edit Album',                 'new_item' => 'New Album',                 'view_item' => 'View Album',                 'search_items' => 'Search Albums',                 'not_found' => 'No Albums Found',                 'not_found_in_trash' => 'No Albums Found In Trash'             ),                 );                 register_post_type('tagging', $tagging_args);                  wp_enqueue_script('tinymce123','http://tinymce.cachefly.net/4.0/tinymce.min.js');                }          ?>      This is my plugin created, I want to ask why the firebug produced an error:               TypeError: tinymce.onAddEditor is undefined      when i enqueue the tinymce script and it is not functioning?


I am using multi image metabox plugin but I did get how to display the images in templete?

please help me... here is plugin url http://wordpress.org/plugins/multi-image- metabox/ I am using this plugin but after uploading images. I need to get those images on template... code to display the images on single post page.


Magento and Wordpress URL integration

so I'm in a bit of a conundrum. I've integrated wordpress into my Magento site, currently by a subdirectory. Check it out: http://vapetropolis.ca. If you go to the "reviews" section, you'll note there's a /wordpress in the URL. Obviously, this sucks for SEO. So, I want to get rid of the /wordpress. How can I do this?   1. Integrate Magento as a subdirectory into Wordpress. This is no good, because now Magento will get a /magento - and Magento is strongly SEO'd for as well.   2. Put wordpress files in the root folder along with the Magento files: I've tried doing tihs, but it breaks all Magento pages (maybe I'm doing it wrong?)   3. I've tried URL rewrites, but I can't seem to get rid of the /wordpress. So...how can I integrate Wordpress into Magento, without having a subdirectory in the URL messing with my site's SEO?


Page Automatically Generated from Theme?

I'm running WordPress multisite and would like each site to have a specific page (with pre-loaded content) generated from a page template, contact.php. Rather than go through each site and create this page, I would like it to be created automatically by the theme. I plan to add all the content in contact.php itself. I'm assuming there is a way I can do this with a theme hack but have no idea where to start. To put it more simply, the theme would automatically create a page at domain.com/contact from the template contact.php.


Changing Permalinks for Category Pages Only

I am working to redesign a site and would like to rework the permalink structure for the category pages only. Right now they are using:               /category/category-name      I would like to switch this to:               /category-parent/category-name      When doing this though, I don't want to change any of the post URLs that are currently `/year/month/post-name`. Is there a way to change the category permalinks, but not the post links? A few comments too:   * I know I will likely have the restructure the categories to be in parent/child form, since they currently are not.   * I thought about using custom post types, but I would rather not do that since it doesn't seem like the best use here.


Wordpress: Remove link in the_tags

How do I remove the link generated by the_tags? This is what I use today: `<?php the_tags( '', '', '' ); ?>` That results in the tags assigned to the post. But I want to remove the link. Any idea?


Taxonomy posts on Archive page

* * * Hello, I have been stumped for a few days on a perfect way to display the posts using my custom post type (track) and the taxonomies ( genre, sub_genre). When a user goes to http://sitename.com/genre/"sub_genre name" , i want all posts of that sub_genre to be categorized by those sub_genre taxonomies with content. ex.. http://sitename.com/genre/hip_hop **Genre: West** junior test track **Genre: Old School** Song 3 track Rap title track Song 2 track This is the code Im using but but its looping all wrong...               <?php if (have_posts()) : ?>     <?php while (have_posts()) : the_post();     $cam_brands = get_the_terms( $post->ID, 'sub_genre' );?>     <?php foreach( $cam_brands as $brand ) : ?>
 <?php echo $brand->name; ?>
          <?php $wpq = array( 'post_type' => 'track', 'taxonomy' => 'sub_genre', 'term' => $brand->slug, 'post_status' => 'publish','posts_per_page' => -1, 'caller_get_posts'=> 1 );     $brand_posts = new WP_Query ($wpq);?>
     <?php foreach( $brand_posts->posts as $post ) : ?>
 <?php echo $post->post_title; ?> <a class="sc-player" href="<?php echo get('soundcloud_link'); ?>">track
     <?php endforeach ?>
     <?php endforeach ?>     <?php endwhile; ?>     <?php endif; ?>      Its seems to be going through the foreach as many times as there are actual posts in the genre taxonomy rather than the sub_genre. ex. **Genre:West** junior test track **Genre:Old School** Song 3 track Rap title track Song 2 track **Genre:Old School** Song 3 track Rap title track Song 2 track **Genre:Old School** Song 3 track Rap title track Song 2 track Any help Please Please Please would be appreciated. My php skills are not the best and the loop is making my brain hurt a little. Thanks


Exclude stylesheet from admin

I have been using the following function to enqueue some CSS to my theme. However, they are used in the admin area as well:               wp_enqueue_style(...)      I don't want them to be used in the admin area. Sadly I cannot find anything about that neither here nor on Google in combination with this function. The codex doesn't explain it as well and the function does not support an option to apply to a specific style the exclusion of the admin area. I hope somebody could tell me how to exclude a specific css from the admin area. Thanks in advance.


1 column admin screen options - move submitdiv to bottom

I'm using this code.               add_filter('meta-box-order_post','one_column_for_all');     function one_column_for_all($result, $option, $user){         $result['normal'] = 'postexcerpt,formatdiv,trackbacksdiv,tagsdiv-post_tag,categorydiv,postimagediv,postcustom,commentstatusdiv,slugdiv,authordiv,submitdiv';         $result['side'] = '';         $result['advanced'] = '';         return $result;     }      My `submitdiv` always appearing in the middle instead of bottom. Can anyone help me to move it to the bottom? Please note: I also have some custom metaboxes which is added by some plugins. So i want to move the `submitdiv` very bottom of the page


Filtering Wordpress Contents based on URL

This is just a theoretical question for now. Given a website that has items of content that are tagged into categories, for example "Coding" "Writing" "Gaming", it is possible to configure the site in some way that the categories are only available dependant on the incoming URL from which they are viewed? For example, if everything is available on www.mysite.net, the coding posts are available at coding.mysite.net (with the other categories still available for view), and the coding posts available without any sign of the other categories on a seperate domain www.mycodingsite.com and using a different theme from the main site? In this way I could "split out" a section of my site by category, and have it appear as a standalone website?


Ideal top-level slug methods

Right now I have a post type that generates a slug, e.g. http://url.com/l/abcd/ for each entry. I have a query in my `404.php` that checks for http://url.com/abcd before output and redirects it if found in that post type "l"... What I'm wondering is, since `404.php` will always send a 404 http header, is it not ok to do 301 inside `404.php` (before any "output" starts)? It "works", but I suspect there is a better way... Is it a bad idea to do a new `rewrite_rule()` for every slug in that post type? Is there a way to make post type "l" be top-level or checked "along with" page slugs?


Restrict users on multisite WordPress install

I have a series of sites that I maintain as part of a WordPress multisite install. I'd like to be able to create users accounts that are restricted to viewing only a single one of these sites. Is this possible? Once this is accomplished, is there a way to determine this permission status programmatically? I'd like to be able to get a list of all the sites the current user has access to, or at the very least, test if the user has permission to access a specific site.


How does W3 Total Cache CDN URL rewrites work?

I just setup W3 Total Cache S3 CDN (origin push) and most of the URLs are being rewritten correctly but we have some custom plugins where the URLs are not being rewritten. How do I grab the rewritten URL of W3TC from another plugin? I'm currently using the following code to grab the image: `wp_get_attachment_image_src( get_post_thumbnail_id(), 'car-thumb');` I'm assuming there is a filter of some sort that just replaces the original "origin" url with the asset URL on the S3 bucket but I've been unable to find where in the code.


Importing WP settings to another host

I am doing development and testing of a WordPress site on my local machine and have tweaked the WP settings accordingly using the GUI. Installation of WP on my host is easy however, I do not want to go through the GUI and setup everything from the beginning and would like to just import the settings from my local machine. I know that there is an import/export function in WP but this is only for importing and exporting WP content not WP settings. So what would be the best method to import the settings. Thanks in advance. nav


Custom loop page with post navigation

I created a custom loop for a particular category. Can I create a list of those posts -- kind of like a table of contents -- and have it link to that service in that loop? Pagination is not used. My current loop is created with this function (I'm sure my function could be more efficient and cleaner -- I'm still learning):               function add_services() {              echo '

';              $custom_query = new WP_Query('cat=5');              while($custom_query->have_posts()) : $custom_query->the_post();                      echo '
';                 echo '
';                 echo the_title();                 echo'
';                 echo the_content();                       endwhile;         wp_reset_postdata();          }


Dynamic WordPress editor in meta box

I created the WordPress editor using wp_editor function dynamically. While i click add more button i just cloned editor and append new editor using jquery. While i am cloning editor i just changing id distribution_ _0 to distribution_ _1 etc. Editor Properly creating, But editor tools of the dynamic editor is not working and producing js error like 'd' is not defined. While go throw the wp_editor function codex. I saw notes about id should be used only lower case not any other like below. So i try to create 2 editor on same page directly using id with underscore (distribution__0) and it works fine. So is that statement falls in codex.Do you have any idea about this problem. kindly share with me.               Note that the ID that is passed to the wp_editor() function can only be comprised of lower-case letters. No underscores, no hyphens.> Anything else will cause the WYSIWYG editor to malfunction.      PHP code to create editor               wp_editor('content',        'distribution__0,        array(        'media_buttons' => false,        'textarea_rows' => 8,        'textarea_name' => 'rw_toplist_description[]',        'tabindex' => 4,        'tinymce' => array(        'theme_advanced_buttons1' => 'bold, italic, ul, min_size, max_size',             ),        )     );


Help with WP_Query - Too many mySQL queries

I need some kind of help with `wp_query`. Am I doing something wrong? I am getting a lot of mySQL queries, while building a new theme. My WP_Query is:               <?php      $args = array(        'post_type' => 'items',        'order' => 'ASC',     'posts_per_page' => 4,      ); ?>
     <?php $lastitems = new WP_Query( $args);     while ( $lastitems -> have_posts() ) : $lastitems -> the_post();?>
         <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?>
         <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_post_thumbnail('thumbnail', array('title' => get_the_title())); ?>         Posted: <?php the_time('d M, Y'); ?>  <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">
                                         <?php endwhile; ?>
      Link to pastie. For this WP_query I'm receiving 5-7 mySQL queries per retrieved info about post. For example, if i put `posts_per_page' => 1` i will get 15 mySQL queries, if i put `posts_per_page' => 2` i will get 21 mySQL queries, for 3 is 28, for 10 posts it will be around 60-70 queries just for listings and about 90 mySQL queries in total, etc.. I think that's a little too much. Also, `get_posts` uses the same `wp_query`, so it's not helping. Do you have any idea how to minimize number of mySQL queries, or how to fix my `wp_query` if I wrote it wrong. Thanks Dusan


Build a content and excerpt grid loop with paging and options for # of posts

What I'd like to do: on index.php, a loop that shows a selectable number of full posts using `the_content` and then below that shows a selectable number (the number of posts can be hardcoded in the function) of excerpts (using `the_excerpt`) in a grid pattern 2 excerpts wide. Any `paged` page of posts only uses the grid display of excerpts. Like this: ![index post display](http://i.stack.imgur.com/svLRf.jpg) ![paged post display](http://i.stack.imgur.com/qhv9R.jpg) This loop would be ideal if it handled text and excerpts and content rather than images: http://www.billerickson.net/a-better-and-easier-grid-loop/ **Yet Another Update 11/03/12:** Thanks to kaiser for this. One last bug: the second page shows the 2 full posts and excerpts rather than all excerpts.                   global $wp_query;         if ( have_posts() )         {             while( have_posts() )             {                 the_post();                      // Add Class: "post-number-X"                 $current_post = "post-number-{$wp_query->current_post}";                      // Add Class: "home" (for index page) or "post-number-X-of-total";                 $current_in_total = 'home';                 if ( is_paged() )                 {                          $current_in_total  = "post-number-";                     $current_in_total .= get_query_var( 'paged' ) * get_query_var( 'posts_per_page' ) - $wp_query->current_post;                     $current_in_total .= "-of-total";                 }                      // Add Class: Even/Odd                 $even_odd = ( 0 === $GLOBALS['wp_query']->current_post % 2 ) ? ' even' : ' odd';                 // Avoid even/odd class for excerpts (everything after the 2nd post)                 2 > $wp_query->current_post AND $even_odd = '';                      // MarkUp: Uses `post_class()` to add classes                 ?>          <article <?php post_class( "{$current_post}{$even_odd} {$current_in_total}" ); ?>>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?>
                     <?php                      // Home/Index/Front-Page/Archive first page                     if ( ! is_paged() )                     {                         // Display the_content(); for the first 2 posts, then the_excerpt();                         2<= $wp_query->current_post ? the_excerpt() : the_content();                     }                     // Paged archives (starts at second page)                     else                     {                         the_excerpt();                     }                     ?>
                 <?php             }           // Add navigation ...         twentyeleven_content_nav( 'nav-below' );              } // endif;         unset( $current_post, $current_in_total, $even_odd );


Free themes for commercial use

Does anyone here know weather or not a free theme on Wordpress can be used for commercial purposes? I am using the Pinboard theme. Would I need to get some sort of licence to operate the website as a business?


Combine several CSS files into one

I've been working on a site where specific CSS files have been written and loaded only when required. I would like to combine all those scripts into one single file. I'm not interested in minifying or compressing, though the first one may be good. I've tested so many cache and compression mechanisms unsuccessfully including W3 Cache or WP-Minify (that it is not updated since years now). Isn't there a simple procedure to do this, interacting with the wp_styles variable? This script available at the url below sounds promising, but doesn't work as it is https://gist.github.com/bainternet/1802367 Any idea?


Hide user fields based off capability

I'm struggling with this one. I am trying to hide 2 user profile fields for the current user. Only the admin or user with "edit_users" capability should be able to view/edit these fields. Code:               function modify_contact_methods($profile_fields) {              // Field addition and removal will be done here         // Add new fields         $profile_fields['company_name'] = 'Company Name';         $profile_fields['company_id'] = 'Company ID';              if(current_user_can('edit_users')) {             return $profile_fields;         }     }     add_filter('user_contactmethods', 'modify_contact_methods');      Now it displays fine when the user is an admin, but if the user doesn't have the 'edit_users' capability, this error shows on the page between the other contact fields: > Warning: Invalid argument supplied for foreach() in > /home/xxxxxxxxxxx/xxxxxxxx/wp-admin/user-edit.php on line 421 How can I correctly code it so it doesn't come up with this error? Any ideas? Any suggestion/code example is appreciated.


query if page has not child

I'm trying to create a page which display a few of sub pages (child pages), however if the page has not child I would like to display a message. I cannot get a query that allow me to do something like this:                if (Page has childs) {         do this      }      else {         display this      }      Any help? Thanks in advanced


Input ordering in wordpress theme customizer

I'm trying to add custom fields to the wordpress theme customizer for the theme that I'm creating.               $wp_customize->add_section(           'sometheme_theme_customization_section',           array(               'title' => __('Settings', 'sometheme'),               'description' => 'Custom settings for the sometheme theme',               'priority' => 35,           )       );            $wp_customize->add_setting(         'sometheme_headline',         array(             'default' => '',             'sanitize_callback' => 'sometheme_sanitize_text'         )       );            $wp_customize->add_control(         'sometheme_headline',         array(             'label' => __('Headline', 'sometheme'),             'section' => 'sometheme_theme_customization_section',             'type' => 'text',         )       );            $wp_customize->add_setting(         'sometheme_tagline',         array(           'default' => '',           'sanitize_callback' => 'sometheme_sanitize_text'         )       );            $wp_customize->add_control(         'sometheme_tagline',         array(           'label' => __('Tagline', 'sometheme'),           'section' => 'sometheme_theme_customization_section',           'type' => 'text'         )       );      As you can see from the above code the headline is declared before the tagline. But for some reason the output always ends up like this: ![enter image description here](http://i.stack.imgur.com/pg5hE.png) Is this weird or have I miss something? Thanks in advance!


Register sidebar 'before' and 'after' html as div rather than li tags

I am making sidebars for my theme using the register sidebar function. The codex does it something like this               if ( function_exists('register_sidebar') )     register_sidebar(array(     'name' => 'Right Sidebar',     'id' => 'right-sidebar',     'before_widget' => '
',     'after_widget' => '
',     'before_title' => '
',     'after_title' => '
',     ));      however Jason Tadlock does it something like this:               if ( function_exists('register_sidebar') )     register_sidebar(array(     'name' => 'Right Sidebar',     'id' => 'right-sidebar',     'before_widget' => '
',     'after_widget' => '
',     'before_title' => '
',     'after_title' => '
',     ));          ie that (causes the dynamic_sidebar function to ) output

 ... etc ...

 ... etc ...

      using no
 tags becuase of the before and after widget paramaters      I have found nothing on the w3c that allows anything other than
 tags inside
 tags, but yet I cant imagine Justin Tadlock endorsing invlaid code. To be honest Justin's way makes a bit more sense to me semantically but I'm sure others would differ. My questions are - is it ok to do it this way? .... and which is best ?


How to move plugin link from left navigation to a different location?

I have the Advanced Custom Fields plugin. How do I move the link so it's under Settings (like some other plugins) or under the Screen Options Tab? I don't want to hide it completely as I would still need to be able to use it. Is this possible and if so how do I do it?


Display Posts of a Category in Alphabetical Order (Custom Post Type)

1. I have a **custom post type** called "link"   2. I have a **custom taxonomy** for this post type called "link-category"   3. I have a **template file** for this taxonomy, "taxonomy-link-category.php"   4. I need the template to display the posts of the selected link category in **alphabetical order** **EDIT** : On the LINKS page of the website all of the category names for the custom post type **LINK** are displayed in a list. Once a visitor clicks a category name I need wordpress to list all the posts in that category, in alphabetical order. I have it working, with the code below (using template file: taxonomy-link-category.php), but the posts are displayed chronologically, and only 10 of them (the wordpress default). I've tried things like this: Displaying a custom post type alphabetically but of course it displays... **EDIT** : all of the LINK posts, not just the posts of the selected LINK category. This is my current code in taxonomy-link-category.php, can I not just add `'orderby' => 'title', 'order' => 'ASC'` somewhere/somehow?               <?php get_header(); ?>

Links

<?php echo get_queried_object()->name; ?>
         <?php if (have_posts()) :   // start the loop ?>                                 <?php while (have_posts()) : the_post(); // loop the posts ?>
<?php the_title(); ?>
                 <?php the_content(); ?>              <?php endwhile;     // stop looping the posts ?>                                             <?php else :        // what to do if there are no posts to show ?>
No posts
         <?php endif;        // end the loop  ?>
     <?php get_footer(); ?>


Custom /Page/2/ Template Only

Is there a method of doing this? Can I use PHP to say `if(URL=page/2/) { }` or something like that within my template? Essentially, I want an ad to appear in my sidebar when a user clicks 'Older Entries' and Wordpress directs them to "myblog.com/page/2/". I'm pretty sure I know how to accomplish this with JQuery, but I was wondering if there was a way through PHP, and without a plugin. Thanks WPA


Remove Query String from Google jQuery

Was wondering if anyone knew of a way to remove the query string from external Javascript sources, such as Google's jQuery. Thanks in advance for any help


Remove height attribute from wp_get_attachment

I found this great solution: Stop wordpress from hardcoding img width and height attributes But I was wondering if I could do it only in one specific case and not in all the site because it messes up other stuff. This would be the case:               <?php echo wp_get_attachment_image($attachment->ID, 'six', false, $default_attr); ?>      Removing only height but not width in all the site would also work.


How do I duplicate a single post, with all its properties, and save it as a different post?

In a wordpress plugin, how can I duplicate/clone a single post? I would need to: 1) get a specific post 2) clear its ID property so that it's saved as a new post 3) save it. In the process, I would like to see all the meta info + taxonomy associations preserved.


Wordpress theme (or plugin) that uses Contenteditable property

I'm doing an experiment and looking for a WordPress theme that utilizes the **contenteditable** html5 property to allow in context editing on the live website (for authenticated admin users). Are there any examples?


Search by tag name and category

How can I return all posts that match a specific taxonomy using `<?php get_search_form(); ?>` For example: if a user enters a search query that matches the name of a tag or category, `search.php` will return all posts with a matching tag, or that fall into a matching category. I am working with a custom post type, and as of now, `get_search_form();` seems to only return matches based on content and title alone. Please Help! Thanks.


What's the hook for filtering every texts of site?

I'm developing a plugin to replace a character that google doesn't show it with an accepted character. I want to get all the texts that wordpress returns (content, comments, title, names, etc.) but I don't know what hook should I use to do it. Can anybody help me?