question
stringlengths
0
34.8k
answer
stringlengths
0
28.3k
title
stringlengths
7
150
forum_tag
stringclasses
12 values
In a single post template I am trying to output some header text in a <code> &lt;div&gt; </code> and display links to related posts in a <code> &lt;ul&gt; </code> if related posts exist (based on tags). If there are no posts, nothing should be displayed. <code> $idspost[] = $post-&gt;ID </code> gets the posts which sho...
To get the data in the array to output as posts I did the following: <code> &lt;?php if(count($idspost)){ echo "&lt;div&gt;Related posts&lt;ul&gt;"; foreach($idspost as $id){ echo '&lt;li&gt;&lt;a href="'.get_permalink( $id ).'"&gt;'.get_the_title( $id ).'&lt;/a&gt;&lt;/li&gt;'; } echo "&lt;/ul&gt;&lt;/div&gt;"; } ?&gt...
Wordpress loop: Display if posts exist
wordpress
I'm about to update my Wordpress blog to the latest version. It was recommended that I backup my posts and database first. It seems like a plugin would be the easiest way for me to do this. What's the best plugin available for this? Searching Wordpress' site I found the BackUpWordPress plugin: http://wordpress.org/exte...
The codex covers this topic VERY thoroughly. Personally, I use WP-DB-Backup , it's the most popular backup plugin that I know of, and it's really easy to use.
Backing up Wordpress before an update, what's the easiest way to do this?
wordpress
I can't get my function to trigger on post update or save. I've found a couple of other forum posts around with the same problem, but never an answer :( My code is as simple as: <code> function pdfgenerator_update($post_ID) { global $MYTEST; $MYTEST["pageID"] = $post_ID; } //add_action('trashed_post','pdfgenerator_upda...
When a post is published/saved, it does not do it in a single script execution. It redirects to a different script, does the save, then redirects back to where you started. If you want to confirm that your hook is working, use <code> update_option() </code> , and delete the option immediately after displaying it so it'...
add_action hook for publish_post not working
wordpress
I wrote my first ShortCode in a file called: myShortCodes.php. Does the add_shortcode go in the same PHP file as the ShortCode itself? Where do I upload it? How does WordPress know to look in my file? I don't have to modify \wp_includes\shortcodes.php do I? So far I have tried uploading myShortCodes.php to wp-includes/...
In general, special theme functionality (including shortcodes) should be placed in your theme's <code> functions.php </code> file, which is in the root of your theme folder. If the code is less than a few dozen lines, it probably won't be worth creating a separate file (unless you just really want to organize your code...
Where to upload my new custom ShortCode in Separate .php file?
wordpress
I am trying to redirect a user once they click "activate" on my plugin, the redirect is working great using the register_activation_hook however the plugin is failing to activate. Any thoughts on what i need to do to make it run the hook after activation and not before? <code> function install_redirect() { wp_redirect(...
From stackoverflow: stackexchange-url ("stackexchange-url <code> register_activation_hook(__FILE__, 'my_plugin_activate'); add_action('admin_init', 'my_plugin_redirect'); function my_plugin_activate() { add_option('my_plugin_do_activation_redirect', true); } function my_plugin_redirect() { if (get_option('my_plugin_do_...
Plugin won't activate
wordpress
So I'm kinda new to this WordPress infrastructure. Everyone's been telling me about how great WordPress is and how something like 10% of the top sites out there are using it. So I have a couple of really basic questions about how this all comes together. Maybe they're really obvious, but not so much to me. I found a th...
The beautiful thing of WordPress (In my opinion) is that you can make almost any website and only have to make a theme and or plugin(s) . You can change a theme, delete things, extend etc. Or you can make a child theme , leaving the original theme intact and overwriting default behavior in a different place. The rest o...
Customising a theme
wordpress
I can't find any info on this anywhere but i'm sure iv'e seen it done before. I would like to have a user taken to the settings page for my plugin after install, so either auto-redirected or change the "back to plugins" link to a custom link. Thanks in advance SOLVED <code> function myplugin_activate() { // TODO: Insta...
Register an activation hook and then redirect the user's browser when you're done installing your plugin. <code> function myplugin_activate() { // TODO: Install your plugin here. // I don't know of any other redirect function, so this'll have to do. wp_redirect(admin_url('options-general.php?page=myplugin_settings')); ...
Redirect to settings page after install
wordpress
I'm changing a menu from a loop with <code> query_posts </code> to a "custom menu" using <code> wp_get_nav_menu_items </code> , but I can't seem to retrieve the <code> post_thumbnail </code> . The original code I had (snippet): <code> &lt;?php query_posts($args); if (have_posts()) : while (have_posts()) : the_post(); $...
Dammit, I just discovered that the <code> $m-&gt;ID </code> I was using wasn't actually the <code> post-&gt;ID </code> , but the <code> menu-&gt;ID </code> . I used <code> $m-&gt;object_id </code> to fix the issue. Hope this will help someone in the future <code> :-S </code>
get_post_thumbnail_id() Doesn't return value
wordpress
I'm creating a theme from a template based on Wordpress 3.0. I've started with items like Starkers which is a completely bare theme, and even tried modifying something by default like Twenty Ten or Eleven. However, the thing that gets me is how can I adjust the css to covert a single line of PHP such as (used as defaul...
<code> wp_nav_menu() </code> pulls from the menus selected/generated in <code> Appearance -&gt; Menus </code> . There will be one <code> &lt;li&gt; </code> for each item in the menu you select.
Converting Menu Links to List Elements
wordpress
I have a index.php with a featured post and a number of other posts and the standard wp_pagenavi at the bottom. I'm using the 2 loops from the wordpress codex like this: <code> &lt;?php $my_query = new WP_Query('category_name=featured&amp;posts_per_page=1'); while ($my_query-&gt;have_posts()) : $my_query-&gt;the_post()...
In short no - the template used is based on the query, and when paginating you are essentially repeating the same query, but for a different page. In general the template will be the same. <code> archive.php </code> can be used for most queries, but often preferable templates exist (e.g. category templates, tag templat...
Hide featured post on second page
wordpress
I'm planning to use WordPress to maintain and publish a role-playing system. Is there a best practice for managing content in WordPress that isn't time sensitive? Should I use pages and make short notification posts when those are updated? I know posts and pages are stored the same, it's handling the creation and prese...
I would recommend using Custom Post Types (and, likely, custom taxonomies ). Some intrepid developers did just that, for a proof-of-concept game built on WordPress, and presented it at WordCamp Toronto 2011 .
Organization of time insensitive content
wordpress
I have extended the user profile page in the backend so that each user profile has several extra custom fields for data such as favorite movies, birthday and so on can be stored. Creating a dating website, that is why more fields are needed. People with the proper code can see these profiles in the front end using an e...
Use <code> wp_generate_password() </code> to generate passwords. For example, you could add a button to the user profile to get a new password per AJAX. And you have a security vulnerability in your current code: <code> $getId </code> , the substring from a visitor request may contain malicious code. Always escape requ...
Password protected Profile View
wordpress
At this point when I activate a plugin and an update is available it updates the plugin. I like to create a plugin myself that I want to use private, I have several WordPress blogs and if I made an update to the plugin I like those several WordPress blogs to state that there is an update available. Does anyone know how...
There is a plugin for that: Automatic Updates For Private And Commercial Plugins . To prevent upgrade checks against the WordPress.org data base in your plugin use the function Mark Jaquith has written .
How to create a plugin that notifies for updates?
wordpress
<code> $cats = $wpdb-&gt;get_results('SELECT term_id, term_taxonomy_id, taxonomy, parent FROM wp_terms, wp_term_taxonomy WHERE term_id = term_taxonomy_id AND parent = 1 AND taxonomy = "category"', ARRAY_A); </code> I'm trying to get all the categories in my database that are children of the category of ID 1, but it's n...
Any reason why you can't use WordPress API? <code> $cats = get_categories(array( 'child_of'=&gt;1 )); </code> See Codex here .
What's wrong with my wp database query?
wordpress
I'm trying to migrate my self-hosted WP blog to WordPress.com, images included. Originally images were hosted on various image-hosting websites, but I've used this plugin to cache and upload them to my self-hosted WP media library. Now posts have image tags in this format: <code> &lt;img src="http://mywebsite.com/wp-co...
I eventually used this plugin to download and cache all images locally, and replace all links to the local ones.
Import images from self-hosted to WordPress.com
wordpress
I have a WP 3.3.0 site running in production. (version.php says <code> $wp_version = '3.3'; </code> ) I have a main menu using WP's built-in functionality. I use <code> wp_nav_menu(array( 'container_class' =&gt; 'menu-header', 'theme_location' =&gt; 'primary')); </code> I made a copy of that site, installed it in a dif...
The markup above looks like a menu was not actually assigned to the area and is using the <code> wp_list_pages() </code> fallback instead. Point release changes (e.g. 3.3 to 3.3.1) are always going to be for major bugfixes and/or security, never for changes in functionality.
Did upgrading from 3.3 to 3.3.1 introduce breaking changes in the menu navigation?
wordpress
I'm creating my first theme (actually a child theme of "twenty eleven") and am not sure how to best approach theme customization. Say that I want to have a RSS link in the sidebar shown or hidden based on some configuration, what's the best way to approach it? The most basic approach would be to go directly into the th...
Your specific example can be addressed by making sure your theme "widgetized" (or supports sidebar widgets). If the example you described is what you're really trying to accomplish, I'd recommend taking that route. (I'll use the term sidebar, but really, a "sidebar" can be placed anywhere in your site... the header, fo...
How to make theme configurable
wordpress
I have a tabbed section on my homepage where I call different feeds for new posts by category of my site much like the new youtube layout. I have 10 different feeds so my question is how important is to have those feeds crawled because I'd like to just rotate them with ajax rather than have all of it called and hidden ...
I would go with jQuery UI tabs where the feeds would be hidden because WordPress caches feeds for 12 hours using the Transients API . This would be less expensive than doing an Ajax call for each tab. Use <code> fetch_feed </code> to parse and and cache. The cache times can be filtered using <code> wp_feed_cache_transi...
Tabbed feeds with ajax vs. without on homepage
wordpress
Can someone explain the differences or different uses of the user_name and user_nicename fields in the users table? They seem to be, and behave the same. I found a bunch of posts in web searches, but they are relevant only to older version of wp.
The nicename is (usually) just a sanitized version of the username. It's suppose to be 'nice' in the sense that it is the 'nicename' that is used as a slug, for example: <code> www.yoursite.com/author/my-nice-name/ </code> will take you to the archive of the author with nicename 'my-nice-name'. The documentation simply...
users table - user_name vs. nicename
wordpress
Default (big and ugly) Thickbox I don't like how this Thickbox's page looks at all, I almost never use all these settings fields so decided to get rid off them, at least on pages where I'm uploading images as theme options. A (very) simple Thickbox Using attachment_fields_to_edit &amp; media_upload_tabs filters I made ...
Tricky but once you understand how WordPress sets the sizes and the fields then the rest is easy: <code> function thickbox_fields($form_fields, $post){ unset( $form_fields['post_title'], //disables "Title" field and so forth... $form_fields['url'], $form_fields['image_alt'], $form_fields['post_excerpt'], $form_fields['...
Thickbox hacking - removing fields
wordpress
Is there a way to get the gallery url of images. What I want to do is this: image1 image2 image3 are in gallery "Pinto". When a user clicked for example on image 1 and it pop-ups in lightbox I want there to show from wich gallery is the image and when the user clicked on that link to go to that gallery. I found out how...
Never mind...i found the CODE (with the help of Alex Rabe), it is as follows: <code> &lt;?php echo get_permalink( $image-&gt;pageid ) ?&gt; </code>
Get gallery url (Nextgen)
wordpress
Is there any plugin that would allow me to easily insert reference to another post for TinyMCE? I want to be able to reference another post by permalink and the link text to be the title of the post. Alternatively, is there any plugin that allow me to do this with short-code? i.e <code> [reference post-id="2345" link="...
I think <code> W4 Internal Link Shortcode </code> plugin is what you're looking for: Now you can easily embed your wordpress sites internal links (of post, page ,category, author) in post content, page content or category description area. Just write the appropriate shortcode, and you are done. No need to update these ...
Plugin for TinyMCE to create reference to other posts
wordpress
Im using WP-Postratings to show thumbs up or down for posts and I want to show on the homepage in post excerpts whether a post in in the plus or minus. If it's in the plus I want to show a custom image but if the negative I want to show a different image. Any ideas on how to do that?
Ok I figured this out. The ratings score is stored as a custom field so I created and if statements to check whether the score was less, equal, or greater than 0 and then I can show something accordingly. Here's how I set it up. <code> &lt;?php $ratings_score = get_post_meta($post-&gt;ID,'ratings_score',true); if ($rat...
Show whether a post is plus or minus with Wp-Postratings
wordpress
I'm using the_excerpt on my index page. I'm also using a dropcap shortcode at the beginning of each of my posts. On the index page the posts will not display the letter with the dropcap shortcode around it. If my post beings with the word "Dog" the index page displays "og". How do I get shortcodes to work when using th...
Paste this in your theme's functions.php file <code> add_filter( 'the_excerpt', 'shortcode_unautop'); add_filter( 'the_excerpt', 'do_shortcode'); </code>
the_excerpt and shortcodes
wordpress
I post music videos on my site and I add the artist name as a custom field to each post. I want to associate certain meta with that artist name so I dont have to enter it everytime like the artists twitter account and link to Facebook. So my question is how could I enter in their meta data once somewhere and call it to...
I think the way I would tackle this would be a non-hierarchical taxonomy. That would allow you to tag the artist and such as well as give you a few fields to work with for basic data input...you also have the ability to expand, should you need it. If you're going to have a lot of terms and you need additional fields, I...
Attaching global meta to custom fields
wordpress
I want Akismet to be activated by default on installation with my Akismet API key. I am making my own distribution that I will use on my own sites and I want the plugin and key to already be activated when installing a new wordpress site.
The link Bainternet provides looks quite promising. Now you only need to automatticaly add the API key. Akismet has a constant for this called *WPCOM_API_KEY* ( source code ). So you could add something like this to your wp-config.php file and Akismet would use it as API key. <code> define( 'WPCOM_API_KEY', 'abcd1234ef...
Activate Akismet on installation with akismet key
wordpress
I'm storing all my options using Settings API: <code> function registerSettings() { register_setting('XX_theme_settings', 'XX_theme_settings', 'setting_validate' ); add_settings_section('theme_options', 'Theme Options', 'theme_options_generate', 'page1' ); add_settings_field( 'XX_Option1', 'Option 1', 'text_input', 'pa...
That's because your options are stored as a serialised array, in one row with name <code> XX_theme_settings </code> . To update one option, you would still need to retrieve the existing settings, ammend the appropriate value and update all options in your array together. For example: <code> $my_options= get_option('XX_...
Settings API - how to update options manually?
wordpress
Is it possible to have the "password protected page" feature of WordPress apply to more than one page? I have dozens of pages which I wish to protect with the same password, but I don't want people to keep having to type the password every time they open a new page. I also don't want people to require an account, all t...
WordPress FTW! It actually works this way out of the box. If you use the same password on multiple pages, it only has to be entered once.
multi page password protection
wordpress
I'm not sure why I haven't been able to find this, but does anyone know how to get the input of the TinyMCE editor? I am using it in the front end and want to be able to save whatever the user has typed into the TinyMCE to a database but cannot find the best way to capture that value. The two solutions that I've implem...
Ok apparently WordPress keeps track of what kind of editor (visual or html) is active as a class which is added to the content wrapper so here is a solution that will get you the latest content in the editor <code> function get_tinymce_content(){ if (jQuery("#wp-content-wrap").hasClass("tmce-active")){ return tinyMCE.a...
How to get the input of a TinyMCE editor when using on the front-end?
wordpress
Ok I have this jQuery that I have tested in a static html page and it works fine. How would I include jQuery to work on wordpress in a plugin? So this is the html page. <code> &lt;head&gt; &lt;title&gt; Welcome to my page&lt;/title&gt; &lt;link rel="stylesheet" type="text/css" href="css/style.css"&gt; &lt;link rel="sty...
You should be using <code> wp_register_script() </code> and <code> wp_enqueue_script() </code> , so, for example: <code> add_action( 'wp_enquque_scripts', 'my_script_enqueue' ); function my_script_enqueue() { wp_enqueue_script( 'my-jquery', 'URL TO THE FILE', array( 'jquery' ) ); } </code> Also, as mentioned by Zack, y...
How to include this jQuery File in wordpress?
wordpress
How can I hook the wp_list_pages function so that it reads a value of a custom field and displays it instead of displaying the page title?
A quick Google Search came up with this Source Try the following: <code> function wp_list_pages_filter($output) { // modify $output here, it's a string of &lt;li&gt;'s by the looks of source return $output; } add_filter('wp_list_pages', 'wp_list_pages_filter'); </code>
How to hook wp_list_pages?
wordpress
Using WordPress custom navigation menus automatically gets the menu item label and displays it between the of the menu item, what I need to do is to get a custom field value of the page and displays it instead of the menu item label. How can I do that ?
You need a stackexchange-url ("custom walker"). Change the function function <code> start_el() </code> to use your custom field’s value.
How to make wordpress nav menu use post custom meta data
wordpress
The WP systems sends a lot of mails to authors. There also plugins who use email notifications for authors. But, let say I have a user, who is managed by two persons (because it's a company, an entity that is more then one person) - I want all the emails to be sent also to a second Email address, that I will enter in t...
Not a WP specific solution, but you can usually set-up an alias/forwarder in your email system that sends a copy to both people. e.g. timandjoe@domain.com sales@domain.com etc.
Adding second Email address for WP user notifications
wordpress
I' having a custom post type with custom taxonomy . In the Post I've specified a post meta value (via <code> update_post_meta </code> ) that has the value '0' or '1' (it's a checkbox). Now I'm trying to generate a list of taxonomy values which have posts assigned to them and the post meta value is set to '1' . Is there...
This will return an array of term objects, if you need these processed to be hierarchical or something, that's pretty easy, I think the challenge you were having was getting the term objects. <code> //get posts $args = array( //basic stuff 'post_status' =&gt; 'publish', //meta query 'meta_query' =&gt; array( array( 'ke...
List Custom Taxonomy Values according to a Post Meta Value
wordpress
I'm currently using a WP-generated list of pages for my site navigation - this is using the method <code> wp_page_menu </code> . I'd like to add custom styling to specfic list items in the menu, and I was wondering if it's possible to have a function that will assign class names to the list items based on the name of t...
Yes - you can do this without having to write any code, too. On the 'Menus' page, locate the 'Screen Options' at the top of the page and locate the 'CSS Classes' check box. Click it. After that, expand a menu item and you'll see a new option for 'CSS Classes'
Assign title-specific class to list items in menu based on WP pages
wordpress
I am currently running the below wordpress php and it is creating a list for me. <code> $term = get_term_by( 'id', $ptc, $taxonomy ); echo '&lt;li&gt;&lt;a href="'. home_url() .'/taxon/'. $pt-&gt;slug .'/' . $term-&gt;slug . '"&gt;' . $term-&gt;name . '&lt;/a&gt; &lt;/li&gt;'; </code> However, I need it to check to see...
It depends on what kind of type are the values from your <code> $product_terms </code> array. If you have strings there, like term slugs, then you probably want to check if <code> $term-&gt;slug </code> exists. If you have objects, then make sure the array is indexed, and not associative. For associative arrays use <co...
How do I determine if a certain term is in an array?
wordpress
How can I let a user see my draft post; but don't allow them to edit them? Some context: I'm the only author and admin on my blog. I would like to let someone else read a post before publishing it. None of the builtin roles seems to be a match for this. The role scoper plugin seems a bit too complicated at first sight....
Share a draft looks like an easy plugin to do this. (Answering my own question after trying a few different things, other suggestions are still welcome.)
How to let someone preview a draft?
wordpress
I am inserting a number of galleries onto a page using the multiple galleries plugin. I want the image to open up in fancybox (highslide js variant or some such) when clicked and installed another plugin called easy fancybox. The problem I am facing is that when the image is clicked in the gallery the image opens up it...
Make sure that your galleries are set as Links to "Image File" and not to "Attachment Post" for Galleries and images. You'll find the settings in the image/galleries pop-up window. I'm not familiar with your plug-in but you might need to manually add the fancybox class to each image. Another option is to add the code t...
Gallery image must open up in fancybox directly not post page
wordpress
I have an existing website with html, css, js, and image files that I am trying to convert over to wordpress. I installed a clean local install using mamp on my hard drive and created a new child theme folder that references the twenty eleven theme. My style.css, header.php, footer.php, and index.php files are customiz...
Theme/Parent Theme/Child Theme usage is irrelevant here. Content is not added via Theme template file , no matter what Theme you use. Go to <code> Dashboard -&gt; Pages </code> , and add new static Pages for each of your site's pages. WordPress will generate them, and the Theme will display them. Edit ok so I figured o...
Linking to Child Theme PHP Files
wordpress
ok this is my first time to include jQuery into wordpress and it has taken me the 2 full days trying to figure this out. No matter how many articles I read I cannot find a perfect example. Ok so this is my plugin file... very simple. <code> &lt;?php /* Plugin Name: jQuery Include Test Plugin URI: http://jquery.com desc...
Your jQuery is wrong. what you want is <code> jQuery(docu.... </code> not <code> $jQuery(docu... </code> . You should try to make sure the components work individually before you put them together (within reason of course), it will make troubleshooting MUCH easier for you.
how to include a simple jquery file into a wordpress plugin
wordpress
I made a custom design for my site. On my header i put my navigation so everytime i call the header the navigation will be called to, so that i would not be calling it all the time. But now i have a problem, on my 404 PAGE , i don't want to include the navigation, but if i don't include the header the themes won't play...
Put <code> &lt;?php if( !is_404() ) : ?&gt; </code> before your navigation and <code> &lt;?php endif; ?&gt; </code> after your navigation and VIOLA! It's gone!
How to display wp_nav_menu() conditionally only when not on a 404 page?
wordpress
I would like to run a filter on post content after it has been created or updated. I would like this to occur after the user has submitted the post, as it may be a bit of a lengthy process (a find/replace to search for glossary terms and replace them with links). What's the most efficient and reliable way to achieve th...
Alright, here's some code I just whipped up. Completely untested, just wrote it right off the cuff...so don't expect it to work 100% when you drop it in, but the core concept is there, as is a decent amount of the legwork <code> add_action( 'my_filter_posts_content', 'my_filter_content' ); add_action( 'save_post', 'my_...
Run a cron job (or similar) in the background of WP after post update/create
wordpress
I'm having an issue with wp_link_pages tag. I want to list the number of pages of each post with 'next' and 'previous' links that are two image arrows. To better understand the problem I'm having, please see this URL: http://next.lab501.ro/smartphone/nokia-n9-meego-to-go/2 At the top of the body you'll see a list of pa...
adjust the 'nextpagelink' and 'previouspagelink' arguments for wp_link_pages() to have a css class you can style <code> $args = array( 'nextpagelink' =&gt; '&lt;span class="next"&gt;' . __('Next page') . '&lt;/span&gt;', 'previouspagelink' =&gt; '&lt;span class="prev"&gt;' . __('Previous page') . '&lt;/span&gt;' ); wp_...
PHP code to use on next & previouspage links
wordpress
Since I posted on their forum and I didn't got any answer, here I am, asking the same question again. So: I made a script that add the posibility to add an image and change the order for the terms of a custom taxonomy (called itinerary). So i use this way of getting each term, one by one (there are only up to 10 terms,...
Actually there is already in their API something for this: <code> icl_object_id(ID, custom_taxonomy_name, return_original_if_missing,language_code) </code> Works like a charm. More read on this : Language Dependent IDs
WPML Translated Term
wordpress
I have an issue that the posts table shows "no posts found" right after the installation although I can see "All (1) | Published (1)" right above it. Now I'm not asking how to fix this very issue, I'd rather learn how to troubleshoot such issues in general . Is there a log file? (Haven't found one.) Is there some plugi...
There are a few things you can do: Use the Debug Bar plugin http://wordpress.org/extend/plugins/debug-bar/ Set WP_DEBUG to true in your wp-config.php file if you are looking for problems in a theme or plugin I created a plugin that allows you to dump any variable into the Debug Bar plugin: http://wordpress.org/extend/p...
How to troubleshoot WordPress issues?
wordpress
Is there a hook in WP to access meta data of a user JUST after they have registered and meta data has been added to the database? I was reading to use <code> profile_update </code> , but wouldn't that be invoked every time they update their profile? I just want something to occur the moment that they have registered, a...
You can use <code> user_register </code> <code> add_action('user_register', 'wpse42506_user_register', 10, 3); function wpse42506_user_register( $user_ID ) { // do stuff here } </code> If you want to just use the user information, you can use <code> get_userdata </code> http://codex.wordpress.org/Function_Reference/get...
Post-Registration, post-meta hook?
wordpress
I'm rebuilding this website - http://www.mediwales.com/news on the WP platform. I'm struggling with the search area in the grey box. I'm removing region and date so we don't have to worry about those but how can I setup the search by keyword AND sector? I've created a custom taxonomy called "news" which will represent ...
You can use <code> pre_get_posts </code> hoot to filter the search query to selected sectors only, something like this: <code> function Search_with_in_a_tax( &amp;$query ) { if ( is_search() &amp;&amp; isset($_GET['sector_array'])) { $tax_query = array( array( 'taxonomy' =&gt; 'news', 'terms' =&gt; $_GET['sector_array'...
Customising the search function?
wordpress
I think that is not possible with some actions or filters, I know that I can do it just with html and using right css styles, and of course php to achieve what I need, or to write some minde actions. Is there already some predefined functions for this or not? Thanks.
Well in that case take a look at this tutorial on how to use the native WP_List_Table
Adding tables to dashboard pages programmatically?
wordpress
I am a rookie theme developer (3 months in) and I am trying to figure out how to implement the following functionality: The theme I am building has a logo which I would like for users to be able to change . I'd like for them to NOT have to do so in the code. Rather I'd like to develop some type of low-tech "Theme Contr...
You can create a basic theme options page using the WordPress settings api Here is a simple example that will create an input field for the user to enter a path to the custom logo. <code> // Add a menu for our option page add_action('admin_menu', 'prefix_myplugin_add_page'); function prefix_myplugin_add_page() { add_op...
How to support letting users add their OWN logo to a custom theme?
wordpress
I have a basic WordPress site set up with the Suffusion theme and the WooCommerce plugin. This is working well for the most part, however when I have folks click / hover over the "Shop" menu icon I would like this to dynamically drop down with the product categories I have defined. How do I make this happen? I'm sure t...
Suffusion supports WordPress nav menus. You'll find these in Admin > Appearance > Menus. Simply add your product categories to the menu as children of the 'Shop' page. Assign the newly created menu to the "Navigation Bar Below Header" location. http://codex.wordpress.org/Appearance_Menus_Screen
WooCommerce dynamic menus
wordpress
I was wondering if anybody knew how to setup step through code for Wordpress. I have tried xdebug but had no luck setting it up on my VPS. I managed to get it working on my localhost at one stage but it didn't track WP too well in conjunction with NetBeans. It either tried to load my page without the core WP files or l...
Not the same as what you want, but perhaps this plugin might be of some help? WordPress Hook Sniffer
Step through wordpress code
wordpress
I'm trying to move the content of a wordpress.com blog to a self-hosted one. Right now I'm just trying to set things up on my local environment. I exported the content using the built-in WordPress exporter from the original blog and the file is a little bigger than 2 megabytes. Anyway I managed to increase the upload l...
I solved my problem. I exported again the whole content, choosing to export the posts separately. This resulted in a much bigger file (almost 8 megabytes) and it seems it contains all posts I wrote in the past.
Importer fails to import every post
wordpress
I'm having an issue that my posts page displays "no posts found" while right above it, there is "All (1) | Published (1)" (it is a new installation). The post is also invisible on the live site, not only in the administration. I guess it might have something to do with my database which is SQL Server using WP Db Abstra...
The problem is not with the "select top 0", but the way the query is changed behind the scenes. Even if you change it to "select * from...", it will break. I managed to get this working by going to "wp-includes\query.php" file, and then removing the $limits variable from the query. This is not the best way to fix the p...
Is "SELECT TOP 0" a bug with MS SQL database?
wordpress
I have enqueued wordpress default password strength meter but don't know how to use it. Currently the codex page doesn't give any link to its documentation. Does any one have any links to its demo page or documentation? Resolved HTML is quite simple. There will be two password box. One div to show the password result a...
Good Question :-) I can not exactly help you with documentation - but I can give a little background on how it works . wordpress uses a jQuery script called password-strength-meter.js (found in the wp-admin/js) directory . It is actually only a function (called passwordStrength(f,i,d) where f = password1, i = user_logi...
How to use wordpress default Password Strength Meter script
wordpress
is it possible to insert data through a script or HTML site into the wpdb and this will show up as normal article in the, the same as when I use the 'create new post' page? Which tables are affected or should I care about? BR, mybecks
Yes its possible but why go over the trouble when you can use the native functions like wp_insert_post that will take care of the interaction with the database. If you are still looking to do it directly by <code> $wpdb </code> then the post data is saved in the posts table, the meta data for posts is saved in the post...
Insert data through a script directly in the db
wordpress
I'm simply typing wp_list_comments() in page.php but nothing is shown. But if I put the comments_template() tag there, then the comment form, comments and pings are shown. Why is that, why can't I use wp_list_comments() in page.php? What could I have done wrong?
You need to include comments functionality via <code> comments_template() </code> , because this function doesn't merely include the <code> comments.php </code> , file, but also handles all of the querying and functions required for displaying comments. While the Codex doesn't really get into details , you can see, by ...
How to call wp_list_comments() outside of the comments template?
wordpress
I have a live WordPress installation and a local one for development purposes. I just exported the live database, replaced all occurences of the live siteurl with the local one, and imported on my dev machine. Problem is that on my dev machine all users have lost any permissions. When logging in I get: <code> Notice: U...
I just exported the live database, replaced all occurences of the live siteurl with the local one, and imported on my dev machine. Finding/replacing with a text editor breaks serialized data; you must change values with MySQL queries in phpmyadmin: <code> UPDATE wp_options SET option_value = replace(option_value, 'http...
WordPress missing user roles on local dev machine. Live site works fine
wordpress
I'm very new to WordPress and I'm sorry if this question may sound ridiculous. I need a way to add the post title into it's content, only in specific posts, and not always at the same place in the content. I've done some research, but all I find is about changing functions in .php files or in The Loop . I don't know if...
Use a shortcode . In your plugin or theme ( <code> functions.php </code> ) add: <code> add_action( 'after_setup_theme', 'wpse_42534_add_permalink_shortcode' ); function wpse_42534_add_permalink_shortcode() { add_shortcode( 'permalink', 'get_permalink' ); } </code> Now, your users can use the string <code> [permalink] <...
Add page title as a javacript variable to specific posts
wordpress
All I am using formidable plugin and on one page i need to use 5 shortcodes. <code> [frm-entry-delete-link id=9 page_id=25 field_key=hsn108] [frm-entry-delete-link id=12 page_id=25 field_key=cp7pi] [frm-entry-delete-link id=13 page_id=25 field_key=ksa9qv] [frm-entry-delete-link id=14 page_id=25 field_key=9zuf6o] [frm-e...
You can create your own shortcode which will hold all of that for you hardcoded: <code> add_shortcode("my_five_forms","my_five_forms_handler"); function my_five_forms_handler($atts,$content =null){ $con = "[frm-entry-delete-link id=9 page_id=25 field_key=hsn108] [frm-entry-delete-link id=12 page_id=25 field_key=cp7pi] ...
How to pass multiple values in shortcode?
wordpress
I have created an enclosing shortcode that is styled to be a button with the intention of putting content in it. I am echoing this shortcode inside a theme file and want the content to link to a specific relative page. However, I am not using the proper quotations and can't seem to figure this rudimentary php syntax ou...
<code> &lt;?php echo do_shortcode("[apply]&lt;a href='" . site_url() . "/quick-quote'&gt;Quick Quote&lt;/a&gt;[/apply]"); ?&gt; </code>
Emdedding PHP in shortcode $content
wordpress
So I got this template which originally queried regular WP posts by their categories so that the page would show a category name for "category 1" as a headline and then posts from that category below it. The same for "category 2", "category 3", etc. I'm trying to make it work with custom post types, so that "Post type ...
I believe the problem is how you are using this code: <code> $args = array('post_type' =&gt; array( 'make', 'model', 'price' ), 'showposts'=&gt;100, 'orderby'=&gt;'date'); $type_posts = new WP_Query($args); </code> You may want to change it to something like this: <code> $args = array('post_type' =&gt; array( $post_typ...
Custom post types instead of regular post's categories in a page template
wordpress
Just a question : I want to use <code> get_category_parents() </code> to display a breadcrumb on a category archive page, but with no link on the current displayed category (SEO purposes, because they say that's a link to itself. I'm not sure search engines are that stupid, but anyway). Like this : link_home &raquo; li...
I wouldn't consider this any better/worse than Kaiser's option, but just different. Why not use <code> get_category_parents </code> on the parent category and then (optionally) append the current category? I haven't tested this, but something like the following should work: <code> $cat_id=7;//current category's ID (e.g...
How-to get the get_category_parents() breadcrumbs trail without link on last item
wordpress
Is it possible to add default prefix to the slug of each newly added Tag . So that full slug, would be stored in database (no rewrites). For example: Name : Tag1 -> Slug: prefix-tag1 Name : Tag2 -> Slug: prefix-tag2 ...
You can use the <code> created_term </code> or the <code> created_{taxonomy} </code> hooks which are fired just after a taxonomy term is created (the second only if it matches the taxonomy). The following will only alter terms in the taxonomy 'my-taxonomy'. (I believe for the default tags, taxonomy should be 'post_tag'...
Set default (auto) slug prefix for Tags
wordpress
How do I get my post thumbnails to show up on the recent post widget or a commenter's avatar to show up on the recent comments widget?
There is no ability in the default widget, you will need to use third-party plugins to acheive your goal. Here are some that I have found. http://wordpress.org/extend/plugins/yd-recent-posts-widget/ http://wordpress.org/extend/plugins/get-recent-comments/
Post Thumbnails on Sidebar Widgets
wordpress
I want to be able to reorder posts and have them listed in this custom order from the category page. I've downloaded and activated the Postmash plugin but am having problems with installation. I've copied this text <code> &lt;?php $wp_query-&gt;set('orderby', 'menu_order'); $wp_query-&gt;set('order', 'ASC'); $wp_query-...
Used this Postmash plugin instead. Works perfectly without modifications to templates.
Using Postmash plugin in Wordpress 3.3.1
wordpress
I'm trying to utilize the authors from wordpress to create a spotlight block in the sidebar that selects 1 random author from multiple users and only displays that 1 users information. I want to include the author's display name, a thumbnail, snippet of their bio and a link to the full author page. I haven't found any ...
You can cut a lot of steps out of this if you use <code> get_users() </code> instead of your custom SQL query. You can then select a random user out of that array using <code> array_rand() </code> (native PHP function, not a wordpress function) and it will return the key you should be using. Here's an example: <code> $...
Sidebar random author spotlight
wordpress
I know I can set a static page as the homepage but is it possible to set a single custom post as the site front page? I created a custom post type called "portfolio" where users can add all the work they have done as posts and I need one of those posts to display as the homepage, exactly as if you would set a static fr...
You don't want a post to be the front page, you want a custom post type entry to be the front page. Now that we have the terminology right, yes it's possible. A client once asked me to do the exact same thing. They had a custom post type they needed displayed on the front page. Doing so was as simple as adding a filter...
Is it possible to use a single custom post as the site front page
wordpress
Trying to iterate through a list of the sites and I can't seem to get set_blog_id working. Here's the sample output: Array ( [0] => stdClass Object ( [blog_id] => 2 ) [1] => stdClass Object ( [blog_id] => 3 ) [2] => stdClass Object ( [blog_id] => 5 ) ) get new_blog_id from array and check value - blog_id= 2 current_blo...
Use <code> switch_to_blog( $new_blog_id ) </code> instead. You can find the function in <code> wp-includes/ms-blogs.php </code> . Update <code> $wpdb-&gt;set_blog_id() </code> doesn’t change the global variable <code> $blog_id </code> which is returned by <code> get_current_blog_id() </code> . <code> switch_to_blog() <...
Can't seem to get set_blog_id working, it just doesn't reset the blog ID
wordpress
Here is the simple front end post submission form code <code> &lt;?php $postTitle = $_POST['post_title']; $post = $_POST['post']; $submit = $_POST['submit']; if(isset($submit)){ global $user_ID; $new_post = array( 'post_title' =&gt; $postTitle, 'post_content' =&gt; $post, 'post_status' =&gt; 'publish', 'post_date' =&gt...
Take a look at stackexchange-url ("this answer") and at to store the image as a custom field replace: <code> update_post_meta($new_post,'_thumbnail_id',$attach_id); </code> with what ever name you have for you custom field ex: <code> update_post_meta($new_post,'products_image',$attach_id); </code>
Front end post submission form with duplicate type fields
wordpress
Need 1 post from each. <code> &lt;?php global $post; // required $args = array ( 'tax_query' =&gt; array ( 'relation' =&gt; 'AND', array ( 'taxonomy' =&gt;'category', 'field' =&gt; 'slug', 'terms' =&gt; array ('economy','the-constitution','monetary-policy','liberty') ), array ( 'taxonomy' =&gt; 'highlight', 'field' =&g...
<code> &lt;?php $categories = array('economy','the-constitution','monetary-policy','liberty'); foreach($categories as $category) { $args = array( 'posts_per_page' =&gt; 1, 'category_name' =&gt; $category, 'tax_query' =&gt; array( array( 'taxonomy' =&gt; 'highlight', 'field' =&gt; 'slug', 'terms' =&gt; array( 'lead','fe...
How to limit posts to 1 from each term with tax_query?
wordpress
I work in a small print shop and I want to digitize our workflow. I have found many plugins that are for support tickets, but I want to be able to create job tickets for printing jobs. I have found several of form plugins (Gravity, Formidable Pro) that make the form portion easy, but I need a way to create reports and ...
Yes, it's possible. WordPress uses a relational database and you're free to add tables to it. As a warning - you will need to create new functions/classes to work with your new tables. WordPress' built in functions will probably not work with new tables. As a side note, new content types such as reports and tickets can...
Creating Job Tickets
wordpress
Do I need to use the Simple Facebook Connect plugin? or can I just use some facebook api code? Any help appreciated. The example i'm trying to replicate is the interface at lookbook.nu. Once you login with facebook, there is a nice page to invite your FB friends.
An easy way would be to include the Facebook Javascript code: <code> wp_deregister_script('facebook'); wp_enqueue_script( 'facebook', 'https://connect.facebook.net/en_US/all.js' ); </code> Then use the default Facebook invite page. <code> &lt;script&gt; function facebookInvite(){ var request = { message: 'my message', ...
How do I create a page for users to invite their facebook friends?
wordpress
First time poster. I'm trying to export a bunch of custom posts out to a csv file so I can easily import them into a new database. I've ran the native export to xml, but it's not the correct format I need. I need a column based format (ie. name, height, weight, etc.). I have a custom post that has several custom fields...
With the help of @toscho pointing out <code> get_post(); </code> , I was able to spit out a .csv with a blank template. At first, I had memory limit issues b/c of the amount of data, so I moved the site locally and was able to get everything I need with the <code> get_post(); </code> This is the gist of it: <code> &lt;...
Export entries and multiple custom field meta to .csv?
wordpress
There are plenty of WP plugins for one-way correspondence... ie mailing lists where the owner can send out newsletters, etc. but i am looking to integrate the functionality of a listserv or email group for my WP users, where anyone in the group can address the whole group, but those outside the group cannot. i could do...
We're currently developing this for a client. It turned out to have pretty complex needs. For example, as the group grows, the number of emails being sent becomes huge (i.e. every email response goes to hundreds of people), so we are running that part of the service through SendGrid. We want everything to run through t...
Is there a wordpress listserv or email group plugin?
wordpress
if I add this code in my theme function.php <code> add_image_size('thumb' , 130, 65, true ); // Thumb add_image_size('max' , 610, 305, true ); // Maximum add_image_size('min' , 270, 135, true ); // Minimum </code> &hellip;the file names of uploaded images is: photo-name-130x65.jpg photo-name-610x305.jpg photo-name-270x...
If you want to ensure your image sizes remain available when switching themes, then you should place them into a plugin. Create a .php file (name it what you want) and place it in wp-content/plugins/, then paste the following: <code> &lt;?php /* Plugin Name: My Custom Image Sizes Plugin URI: http://pippinsplugins.com/ ...
How can i make this in the_post_thumbnail?
wordpress
The Question With WordPress Importer , why can't I import post meta containing a multi-dimensional array, in which value(s) of that array contain line breaks? Is there a workaround that I can do to save my data so it will work? Is there something I can do in my sanitation proces to format the data differently before sa...
I would wage that your issue is with <code> \r\n </code> (CRLF). If the newlines are created in Windows, they'll go into the database as <code> \r\n </code> and when serialized get counted as 2 characters. Then when importing, they'll only be counted as 1 character and they'll corrupt the string. I tested this hypothes...
With WordPress Importer, why can't I import post meta containing a multi-dimensional array, in which value(s) of that array contain line breaks?
wordpress
just done on my feed burner, I noticed however, that author is not being labeled in the RSS feed: http://feeds.feedburner.com/BiotechStart . How should I able to do that? any idea please.
It actually is working, though FeedBurner doesn't include it in the HTML page. When I add it to a feed reader, the authors show up. I'm not completely familiar with FeedBurner, perhaps there's a settings for that?
How to add the Author on my RSS Feed
wordpress
Working on a directory listing and have cobbled together the shortest query I can. It appears to return the listing ok (I think) but the foreach is somehow failing to process the array properly. Can anyone give me a tip on what I'm doing wrong? <code> global $wpdb; $site_blog_ids = array($wpdb-&gt;get_results($wpdb-&gt...
You're setting <code> $site_blog_ids </code> to be an array of arrays. In that case, you'd want to do <code> foreach ($site_blog_ids[0] as... </code>
Retrieving multisite blog IDs, somehow failing to foreach them properly
wordpress
I'm creating an additional WordPress Network admin page, and I need to store some system-wide option. The good thing that a config file will be generated, so no access is required from the child blogs, but the question is: how to store options to Network Admin, and where will they be stored in the database? Thanks, Pet...
Use <code> add_site_option() </code> and <code> update_site_option() </code> . You can find these functions in <code> wp-includes/functions.php </code> .
WordPress Network admin options page: how to store options and where will they be stored?
wordpress
One of my clients has a number of documents in PDF format that he wishes to provide download links to on his site. One solution I have been toying with is to treat them similar to images and upload them through the media uploader provided with WP and then provide a named link to the file. I would like to know if the ab...
the method you have described is valid , and technically you can use it without a problem. Other options you have are : 1.Upload via FTP to a "PDF" folder (or whatever name) and MANUALLY link the files. Change the default "upload" folder only for the time you upload the pdf files (this method is not reccomanded and wil...
Uploading PDF file and providing download links to them
wordpress
currently I can only do it in a normal non-wordpress way. So, does wordpress provide a solution for this circumstance?
It does, have you look at Bainternet's solution stackexchange-url ("to this question") and my answer stackexchange-url ("to this question")? To summarise, you need to post the request to the WordPress' admin-ajax url. If the ajax is for use on the admin-side then this url should already be available as the javascript v...
How to post form in ajax mode and handle it in wordpress
wordpress
A third party developer made a text widget with title, body and thumbnail. This accompany widget plugin has not been internationalized and therefore the strings do not appear in WPML's string translation management. I need them to be loaded. So I am trying to register the plugings domain as indicated here , but the cod...
After some great help - even though a bit late - from the guys at WPML , especially @Brooks I managed to ge the code fixed. The icl_register_strings() function was in the wrong place so WPML I shifted it to the update() Method from where one can sanitize the instance variables before they are used by the widget. The ic...
Internationalize plugin so strings can be translated in WPML
wordpress
When I need to get a single post type list I usually use <code> get_posts </code> , how can I retrieve multiple <code> custom posts types </code> to populate the site homepage? To be more precise, I would like to get the latest mixed posts (so mixed slugs like work, photo, code) and oreder them by date. I could call <c...
The <code> post_type </code> argument of the <code> get_posts() </code> function is for retrieving different types of post content. I'm assuming here that 'work', 'photo', and 'code' are custom post types. Grabbing multiple post types with WP_Query Instead of using <code> get_posts() </code> , you can use the <code> WP...
Getting the list of the latests posts and custom type posts in the homepage
wordpress
I've been using Wordpress for a while, and I really like it \o/... I've written plugins for the Joomla platform but I'm sort of struggling getting going on the wordpress platform : Here's my plan. I'm in the process of writing a plugin that uses Flash to allow the user to record audio from the soundcard (my idea is to ...
you should use <code> wp_print_scripts </code> hook for your scripts instead of <code> init </code> and in your callback make sure that you are not in the administration pages something like this: <code> add_action('wp_print_scripts','register_libraries'); function register_libraries(){ if (!is_admin()){ //enqueue your...
Plugin development - loading Javascript and Flash
wordpress
I'm trying to create my first comments list and comment form in my wordpress site but the dates are displayed as <code> %e %B %Y at %H:%M </code> instead of the date. It seems like the <code> date format </code> isn't recognized. I've simply written this code: <code> &lt;?php $args = array ( 'avatar_size' =&gt; 48 ); w...
Taken from comments: The plugin qTranslate cannot parse the time format string if no time options are set. Disabling the plugin or setting the time options fixes the problem.
In wp_list_comments comment dates won't work?
wordpress
Hi I found some new code in the wp-config.php file of one of my sites, it seems to have been placed there by a hacker, anyone can explain what it does? http://pastebin.com/fdMJCAXw
There are 3 main 'functions' of this code. The two lines check that <code> pingnow </code> and <code> pass </code> are defined and that <code> pass </code> is the correct value. <code> pingnow </code> is used later to switch between 'functions'. The first is run if the <code> pingnow </code> GET variable is <code> logi...
Explanation of this hacked code
wordpress
Suppose that I have a blog with few posts per month, and no comments, and I don't want to show posts in single post pages, but always "in context" (say, together with the posts in its month - or perhaps a week?). To accomplish this, I'd need to use permalinks with fragment identifiers (#), among other things. I wonder ...
There are two hooks named <code> 'pre_post_link' </code> and <code> 'post_link' </code> . Their first argument – which you can change – is the permalink. So … <code> add_filter( 'pre_post_link', 'wpse_42406_change_permalink', 10, 2 ); function wpse_42406_change_permalink( $permalink, $post ) { // change the permalink, ...
Must permalinks always point to single post pages?
wordpress
I need some advice on how to arrange my posts to make it user friendly in the back end. I've created lot's of websites using pages but this is the first time that the post area is quite comprehensive. I've got 4 different types of post - news, events, articles &amp; opportunities. Firstly what's the best way to separat...
Post Types I would certainly register 'News', 'Events' and 'Opportunities' as custom post types , while maybe keeping 'Articles' as the default 'Post' post type. (See the Codex on c ustom post types ). This would, among other things, allow you to register/de-register metaboxes for specific post types where appropriate....
Utilising posts with various post types & categories?
wordpress
I'm trying to explore new ways of embedding videos on to my site as a few of my contributors are having trouble viewing flash embeds when they use the preview function. Ideally it would be easiest to use oEmbed via the [embed] shortcode but i'm running into a problem that I don't seem to be able to find a solution for....
When you're referring to using oEmbed codes, I'm assuming that you're referring to WordPress' ability to take a URL to media (such as one from YouTube) and automatically embed that into a post. If that's the case, then you can take advantage of the <code> embed_oembed_html </code> hook that WordPress provides. Here's h...
How can I force oEmbed to display fixed height & width dimensions?
wordpress
I shall explain my situation as best I can so you can see where i'm coming from. I'm working on a wordpress site for a sports team, there are loads of teams. We want to put coaching sessions on our site. This is so that all the coaches can see how the sessions should be done as many are parent coaches. The problem is t...
First: You will need a plugin that acts as an intermediary for your cloud storage. Cloud storage innately (if setup properly) will protect your files. I have used the CDN Vault plugin and it works great. It's a premium plugin that depends on Amazon S3 storage. It does some really great obfuscation and encryption so you...
Protecting HTML5 video
wordpress
I'm building up a video-site using wordpress. It embeds videos from different sites. I really need a simply "Report broken video"-button that saves the url in a database or emails it to me. I've searched through some plugins, but can't find any that does the job. Do you guys know any simple and easy solution to this? T...
Basically, you filter <code> 'the_content' </code> and add a button. Okay, it might be slightly more complicated: You need to send a mail per <code> wp_mail() </code> . You need some spam protection: a hidden text field which should stay blank and a nonce field . You may want to restrict the pages where the button form...
How to make simply "report" button on posts
wordpress
I have a site with about 1,000 posts spread out over 70 or 80 categories. Some of these categories require the posts be sorted by a custom field, others not. I've got a working solution by having 60+ category template files defined (e.g. category-123.php, category-124.php) and each of those calls a separate loop file: ...
I would suggest to hook onto <code> pre_get_posts </code> and alter the query, rather than firing off your own in the template (it keeps your template tidy, and you'll avoid doubling your database queries!). Below demonstrates this, plus a bonus settings field in the admin (under "Reading") to select the categories tha...
Efficiently sort only certain categories by custom field
wordpress
I have a custom walker and I would like to either <code> get_the_content() </code> (up to the Read More) or <code> get_the_excerpt() </code> to use in this walker, but I can't figure out how to get it to work - it either returns nothing, or if I put an <code> $item-&gt;object_id </code> in it (thinking maybe it needed ...
For anyone who might be looking for the same thing, this is what I did in the end: I abandoned the Custom Walker idea and used <code> wp_get_nav_menu_items </code> to get a list of post IDs from my custom menu, from this tutorial on Digging into WordPress : http://digwp.com/2011/11/html-formatting-custom-menus/ In my f...
How do I get_the_content in a custom walker?
wordpress
I am making a login form in WordPress and i want to have a validation on it, so i tried to look at the wp-login.php to see how they validate things. But i did not find what i am looking for. I would like to know how they validate things or what input do they need to validate things. I tried to search the WordPress foru...
Look in <code> wp-includes/general-template.php </code> at the function <code> wp_login_form() </code> . Follow the functions called there. I’d say: just use <code> wp_login_form() </code> . It does probably everything you need, and you can customize it.
Where is the query in wp-login.php
wordpress
I recently updated a WP site from 3.0.1 to 3.3.1. The site has been having a lot of problems since the update. I want to restore the site to a version I backed up right before updating. I used the EZPZ OCB plugin to backup the site. Is restoring it as simple as deleting the current server files and then uploading the b...
It's never a good idea to run an old version of WordPress, so I would recommend finding the source of the issues above all else. Old versions receive no security updates and have no long-term support, so by rolling back you're leaving yourself extremely vulnerable to security issues that have since been fixed. To fix y...
Restoring from a Backup after Update
wordpress
In my plugin, I am trying to get the current date/time of the blog into the code but it seems to be returning a odd date/time. If i put a new post on the blog it does show the correct date/time so I am not sure what the issue is. Am I handling the code incorrectly? (Post Time: Published on: Feb 13, 2012 @ 22:45) PHP Co...
There is a function in WordPress called <code> current_time(); </code> which you pass either 'timestamp' or 'mysql' to and it returns a time. For more information: http://codex.wordpress.org/Function_Reference/current_time
Get Wordpress current date/time
wordpress
Hi i am new in wordpress and want to know about <code> query_posts() </code> function. If there is index page or home page than there is no need this function to display post but if i made custom page than there this function must used to display. Why?
See stackexchange-url ("When should you use WP_Query vs query_posts() vs get_posts()?") For a custom post type or a simple page you don’t need <code> query_posts() </code> . Usually, you almost never need it, because it will replace the default query which leads to some counter-intuitive side effects. When in doubt use...
why to use query_posts() in custom page?
wordpress
Wondered if anyone knew an easy way around this. The code behind my local dev version of a WordPress instance and the live version are in sync (as they should be). Problem is this means the "Jetpack" plugin is working on the live version (since it's a live blog that can connect to WordPress.com) but not on the local de...
As of JetPack 2.2.1 there is now a local development/debug mode. http://jetpack.me/2013/03/28/jetpack-dev-mode-release/ use: <code> define ('JETPACK_DEV_DEBUG', true); </code> in your wp-config and you should have access to any modules that don't require a connection to function. Yay!
Jetpack Running Locally
wordpress
How can i remove the whole menu in the admin? I have this code: <code> function remove_menu_items() { global $menu; end( $menu ); while ( prev($menu) ) { $value = explode( ' ', $menu[ key($menu) ][0] ); if ( $value[0] != NULL ? $value[0] : "" ) { unset( $menu[ key($menu) ] ); } } } add_action( 'admin_menu', 'remove_men...
<code> add_action('admin_head', 't5_hide_menu'); function t5_hide_menu() { $GLOBALS['menu'] = array(); ?&gt; &lt;style&gt;#adminmenuback,#adminmenuwrap{display:none !important} #wpcontent, #footer{margin-left:0 !important}&lt;/style&gt; &lt;?php } </code> Now I want to know: why? :)
Remove the whole menu in the admin
wordpress
I just moved servers. When calling <code> wp_get_attachment_image() </code> or any of its sister functions the image returned is always the full-size image, scaled down, instead of the requested thumbnail size. This has a pretty nasty impact on load times. Both AJAX thumbnail rebuild and Regenerate Thumbnails those hav...
Found the problem. It turns out somebody had done a slightly rough search and replace on the DB, breaking the delicately serialized data in wp_postmeta. thankfully I had a backup.
Moved server, and WP now uses original images for all thumb sizes?
wordpress