question
stringlengths
0
34.8k
answer
stringlengths
0
28.3k
title
stringlengths
7
150
forum_tag
stringclasses
12 values
I have a custom query to display random posts in my sidebar like this: <code> $newQuery = array( 'post__in' =&gt; get_option('sticky_posts'), 'post_type' =&gt; 'ad_listing', 'posts_per_page' =&gt; 10, 'orderby' =&gt; 'rand', 'post_status' =&gt; 'publish'); // Get new set of ads $smStickyPosts = new WP_Query($newQuery);...
Suggest you have a look at http://wordpress.org/support/topic/passing-current-single_tag_title-as-variable-into-new-wp_query - I suspect the very last comment which covers both backing up and reseting your query will help.
Problem with WP_Query loop and search term
wordpress
I'm using the TwentyTen theme to create a child theme, but I can't seem to get rid of the 'One column, no sidebar' page template that is in the TwentyTen parent theme. I thought just copying it over and deleting the contents would do the trick, but it seems not. Does anyone know how to do this? I'm sure it's very simpl...
Overriding that template would be much easier than getting rid of it. Just the way logic goes. I make no claim it's efficient idea (late here), but this would get it nuked from edit screen: <code> add_action('admin_head-post.php','remove_template'); function remove_template() { global $wp_themes; get_themes(); $templat...
How to *remove* a parent theme page template from a child theme?
wordpress
Hay Guys , I'm currently making a plugin so that the administrator can manage "Subscriptions" to the website. I have made a custom post type and activated it within WordPress and only allowed the title field. This works perfectly on the backend, but now i need a way for front end users to add their email address. How w...
Rake a look at wp_insert_post() which handles the insertion of new posts to the database. and there are many example how to create posts from the front end stackexchange-url ("here"), stackexchange-url ("here"), stackexchange-url ("here"), stackexchange-url ("here") and stackexchange-url ("here"):
Allow front end users to add data to a custom post type
wordpress
I am currently using a custom walker to customize the output of <code> wp_nav_menu() </code> , and I am trying to add additional information to the <code> &lt;a&gt; </code> tags. What I want the output for each menu link to look like is: <code> &lt;a class="boxPAGEID" href="#"&gt;About Me Page&lt;/a&gt; </code> Where <...
The page ID (or object ID, since a menu item can link to any object) is stored in the <code> postmeta </code> table, with the key <code> _menu_item_object_id </code> . So you can get the page ID with the following code: <code> get_post_meta( $item-&gt;ID, '_menu_item_object_id', true ); </code>
Get the ID of the page a menu item links to?
wordpress
We have a custom type <code> music </code> . <code> /music/ /music/post-name/ </code> Also, we have a tag-like taxonomy <code> genres </code> . Its urls are: <code> /music-genres/genre-name/ </code> I'm trying to make urls like: <code> /music/ /music/post-name/ /music/genres/ /music/genres/genre-name/ </code> <code> /m...
Yes, this is possible, because your <code> genres </code> structure is <code> /music/genres/[genre-name] </code> . If it was <code> /music/[genre-name] </code> it would be complicated because it would conflict with <code> /music/[post-name] </code> . You just have to keep the order in mind. The rewrite rules should be ...
Custom permalinks
wordpress
I have a dilemma, well a new blog which im developing and a few of the posts titles are like this 'Tutorial: Build your first App' or 'Tutorial: Start your business with xensuithia' I have a page called tutorials that display the posts from this category. I need the title to not display the 'Tutorial:' part on this pag...
That's because the_title() echoes the title. Use this instead: <code> echo str_replace( 'Tutorial: ', '', get_the_title() ); </code>
str_replace the_title(); blues
wordpress
I want to add <code> &lt;code&gt; </code> tag to my post, easily. For example, Adding code is very easily in Stackoverflow and other sites. Basically, we can add codes between apostrophes (``) I need something like that for Wordpress . Maybe i can use shortcode function for this. For example : <code> [code="&lt;b&gt;He...
I'd suggest using Syntax Highlighter Evolved . It's by Viper007Bond. You can use it like this: <code> [sourcecode lang="php"] &lt;?php echo 'Hello World!'; ?&gt; [/sourcecode] </code> Or even like this: <code> [php] &lt;?php echo 'Hello World!'; ?&gt; [/php] </code> A screenshot: EDIT An example of how you could do the...
How can i share codes on my blog?
wordpress
I am working on a custom Wordpress theme for my bosses website. I have everything working perfectly so far except for one thing... the external javascript files will not work. I followed the exact advice from the links stackexchange-url ("here") and stackexchange-url ("here"), but it still does not work. I have searche...
From my point of view, this should be working. Maybe you can post your custom.js file here. It could be possible that this file has a syntax error or something similar. You could also test if the built-in jquery is working out of the box by adding a simple jquery-command in your header.php . Some hints: The action-hook...
How to link external javascript files?
wordpress
I am having trouble adding a list box to the TinyMCE editor in Wordpress. I have already read entirely through this question but it did not get me all the way there: stackexchange-url ("How i can i add a split button or list box to the WordPress TinyMCE instance"). That solution only alerts the value in a dialog box. I...
In the TinyMCE plugin i wrote, my listbox wraps selected text in HTML, i do that like this.. <code> onselect : function(v) { // Set focus to WordPress editor ed.focus(); // Get selected text var sel_txt = ed.selection.getContent(); // If no text selected if( '' == sel_txt ) return null; var active_style = toggle_styles...
How do I add a listbox to the TinyMCE editor?
wordpress
I have developed a site in worpdress. I need to manage a different questions like "How would you rate our customer service", "How satisfied were you with our service" and more questions and rate these questions and have view on the admin. I tried to find the plugin but could not find. Can anyone let me know if that typ...
Yes, there is a plugin - GD Star Ratings. I am using it here: http://apluginforthat.com/gd-star-ratings/ . You can customize your questions, type of ratings (thumbs up/down vs stars) and much more. You can also configure it to have the ratings appear in your dashboard.
Is there a plugin for rating of multiple questions for wordpress?
wordpress
i was using a wordpress install on an ubuntu server virtual machine. At first the adapter was host-only at an address of 192.168.55.55. The host had this on a vboxnet0 subnet. i changed to bridged adapter to try port forwarding from the router, and now i cant access the page with the new address. the new address is 192...
The easiest way to do this is by using copy&amp;replace in the SQL file. Export the database. Use your favorite text editor and do a copy&amp;replace and import it into a new database. Then you go to wp-config.php and you change the WP_HOME and WP_SITEURL to the new host. Then you change the databasename. You also need...
How do I reset a self-hosted Wordpress URL?
wordpress
I'm using Wordpress 3.1. I need to forbid users to change their first, last and screen names in their profile, but admin must still have this possibility. How can I do that?
Have a look at stackexchange-url ("this question - Preventing users from changing their email address").
How to forbid users to change their first, last and screen names?
wordpress
I have a need to make the Loop run through all of the children of a parent, all of the children of each child, etc. The reason I need the Loop instead of a listing tag like wp_list_pages is so that I can display any information associated with the pages using WP template tags and functions. It's for a showcase-style di...
Sounds like you're looking for a recursive function, ie a function that calls itself. Here's a rough outline of how it can be done: <code> function wpse13669_show_all_children( $post_id, $current_level ) { $children = get_posts( array( 'post_type' =&gt;'page', 'posts_per_page' =&gt;-1, 'post_parent' =&gt; $post_id, 'or...
Using the Loop to show all levels of subpages under a parent page? Halfway there
wordpress
Basically I wrote a function that lets me change the post status to draft depending of a field in the postmeta table: <code> /** * Remove ads if they have been sold for over 5 days */ function cp_remove_sold_ads(){ global $wpdb; // Get all sold ads $sold_ads = $wpdb-&gt;get_results("SELECT * FROM " . $wpdb-&gt;prefix ....
Just look at the examples in the WordPress Codex for: wp_schedule_event wp_schedule_single_event
Create cron job without a plugin?
wordpress
I was helped not long ago with a form of custom truncating by stackexchange-url ("Toscho") on stackexchange-url ("this post") it works very well but I'm finding that I need to create multiple length variations for different bits of content. For instance on my support page I need to 80 max_chars vs. my home page which I...
I know toscho doesn't like this very much, but anyway: Converted the input args to an array: <code> function utf8_truncate( $args = array( 'string' =&gt; null, 'max_chars' =&gt; 200, 'append' =&gt; "\xC2\xA0…" ) ) { $args['string'] = strip_tags( $args['string'] ); $args['string'] = html_entity_decode( $args['string'], ...
Truncating varying lengths of information
wordpress
I'm trying to create a search results listing for a custom post type and the problem I'm running in to is with the way the 'meta_query' parameter is stringing the passed values together. It appears to be treating each 'meta_query' value as an 'AND' rather than 'OR'. Here is the code I'm using: <code> $strsearch = 'lore...
Yes, since WP 3.2 you can set the 'relation' arg: <code> 'meta_query' =&gt; array( 'relation' =&gt; 'OR', array('key' =&gt; '_product_make','compare' =&gt; 'LIKE','value' =&gt; $strsearch), array('key' =&gt; '_product_model','compare' =&gt; 'LIKE','value' =&gt; $strsearch) ) </code> See http://core.trac.wordpress.org/t...
Search multiple custom fields by using meta_query
wordpress
I've two wordpress installs at <code> example.com/blog example.com/otherblog </code> What I want to do is install WP at the root, and have a network, but maintain the URLs. I'm confident I can install WP, and export the single installs, and import them to the network. My question is this: can I do all this, and keep th...
Short answer ... yes. When you install WordPress at the root of <code> example.com </code> you'll be creating a third blog. Don't worry too much about this, just recognize it's there. Create your network using subfolders for the different sites. Then create two new sites: <code> blog </code> and <code> otherblog </code...
Create new network instance, import old single installs AND keep the urls?
wordpress
Hey all, I see that get_the_excerpt() echoes the post excerpt if it is manually set, but not if it is automatically generated (with just the 55 words, for example). [and its use is deprecated] the_excerpt() on the other hand, echoes directly without giving me a string in return. Is there a function to return the excerp...
Sure thing my friend, you see, the function "the_excerpt" (located at "WORDPRESSINSTALLDIR/wp-includes/post-template.php") is the one that makes the echo: <code> function the_excerpt() { echo apply_filters('the_excerpt', get_the_excerpt()); } </code> so, what you want is to use the same function "apply_filters" without...
How to return the_excerpt (without echo)?
wordpress
Most of the plugins I see also send the newsletter, which I don't need. I need a simple, customizable plugin that helps me get user e-mails, name, and other custom fields, and store it in the database. The plugin must also have an unsubscribe option, of course.
Contact Form 7 is pretty flexible. And there's the premium plugin, Gravity Forms , which a lot of people love. Or if you don't really need to keep the subscriber info in your own database, you could always use a service like MailChimp , for which there are WordPress plugins available for subscriber sign-up.
A plugin for newsletter registration (not sending, just gathering data)?
wordpress
I've installed a number of WordPress sites across many different platforms and I'm finding that when installed on IIS7 I'm getting the nasty default IIS7 404 error. I nuked Window's hold on the 404 and now I'm receiving the standard. The resource you are looking for has been removed, had its name changed, or is tempora...
This resolved my 404 error. I essentially went into IIS and directed the 404s to a custom URL “/index.php?error=404“ Article that explained how to resolve the error
WordPress 404 page returning with default in IIS7
wordpress
Are there plugins or hooks to editing custom fields just from the posts listing in admin panel?
The easiest way is to use a plugin like Custom Field Template . This adds a custom field column to the "Manage Posts" page by default.
Adding custom Field To The Posts Listing
wordpress
I have a very simple site that I've modified a very small amount. After installing the Yoast SEO plugin I found that it broke the in post media attach/upload. I'm about 80% sure it's related to Jquery but I'm unable to find anything that refer's to it enqueuing anything. I tried forcing an enqueue from functions.php bu...
You have introduced 2 additional problems by adding the jQuery from Google CDN. The admin interface needs jQuery called in no conflict mode so it won't interfere with the other scripts WordPress uses for the dashboard. The WordPress dashboard is not yet compatible with jQuery 1.5 thats why it was pulled from trunk righ...
Yoast SEO breaking media upload
wordpress
I've got some code inside functions.php which is designed to execute only when the theme is first activated: <code> if ( is_admin() &amp;&amp; isset($_GET['activated'] ) &amp;&amp; $pagenow == 'themes.php' ) { //this code only runs when the theme is first activated } </code> However, I'm pretty sure this code is not ru...
Well, instead of using a $_GET parameter you could store a initiate state in your options-table. E.g. <code> $initialized = get_option('mytheme_initialized'); if ( (false === $initialized) && is_admin() && ($pagenow == 'themes.php') ) { //this code only runs when the theme is first activated update_option('mytheme_init...
How can I run code in functions.php when switch_theme() is called?
wordpress
i have a stupid situation, where i somehow can't find a solution and would really need some help! So... i'm working on a project, where i have in addition to Post and Pages two Custom post types: Photos and Events. I have created a custom taxonomy named "Tags". This taxonomy is applied to Post, Pages, Photos and Events...
To use the built-in tag functionality with a custom post type, you need to add this argument when registering your post type: <code> 'taxonomies' =&gt; array( 'post_tag' ), </code> So to register a post type events, you'd do (eg): <code> register_post_type( 'events', array( 'show_ui' =&gt; true, 'taxonomies' =&gt; arra...
display custom taxonomies limited to custom post type?
wordpress
How can I debug problems with WordPress Cron? I think it will trigger when users go to your site but any errors wont be shown to them, as the jobs are run "asynchronously". So how might I debug errors? I use <code> wp schedule event </code>
You can run WP cron manually by calling: http://example.com/wp-cron.php?doing_cron If you don't want the automatic cron to run while you're debugging, then add this to your <code> /wp-config.php </code> file: <code> define('DISABLE_WP_CRON', true); </code> If you're on a development environment and want to output debug...
How to debug WordPress "Cron" wp_schedule_event
wordpress
My theme is in a folder called "mytheme" and the "Theme Name" in the style.css is "My Theme". From that, I'm guessing that the option "template" in the options table is a reference to the folder, not the "Theme Name". I'm asking because I want to be sure that the value I should pass to switch_theme() is a reference to ...
You'r right. The template-tag is based on your directory name. Same goes for a child-theme, which has a base theme as parent. Check out the search_theme_directories() function for more information.
Where are the options "template" and "current_theme" derived from
wordpress
I'm successfully adding buttons to the TinyMCE editor in Wordpress, but the problem is they all show up to the right of the Kitchen Sink button and I have so many that I need them to display on a new line. How do I make the buttons wrap to the next line and/or create a new row for my custom buttons? Here is my code: <c...
I imagine you're also adding a filter <code> mce_buttons </code> to add in the button to, something like.. <code> add_filter( 'mce_buttons', 'add_my_tinymce_buttons' ); function add_my_tinymce_buttons( $items ) { $items[] = 'your-button'; return $items; } </code> Just change the filter to hook onto <code> mce_buttons_2...
When adding buttons to the tinyMCE editor, how do I make them wrap to the next line and/or display in the "Kitchen Sink" area?
wordpress
I've been using drupal for a few years and it's overkill. I want to pay someone to migrate my content (blog posts and pages) over to wordpress without spending more than is necessary. Is there a specific site such as odesk, elance, guru, rentacoder, etc. that is popular with wordpress programmers and tends to have the ...
oDesk has lot of WordPress developers that could migrate your site from Drupal to WordPress at low cost. I like oDesk because it takes screen shots every few minutes as the contractor's work on your job. You can monitor their work very effectively, particularly if you understand the work being done. In this case if you...
Which freelance sites are recommended to find WordPress developers/programmers, etc
wordpress
Is it possible to make a template for all posts in a custom post type? For example I would like to be able to change an adsense ad or some other element on every post by simply editing a custom template. I have been experimenting with templates that are pretty static, but I am stumped on which one to copy/edit for the ...
Yes it possible, take a look at Template Hierarchy codex entry to get a better idea but the simple answer is to create a template for all of you custom post type posts create a template and name it <code> single-{post_type}.php </code> so if your post type is named dogs then your template file should be named <code> si...
Troubles with making a custom template for posts
wordpress
http://core.trac.wordpress.org/browser/trunk/wp-includes/formatting.php#L2239 I'm confused about when should either of them be used. Assuming I have this URL: <code> http://site.com/?getsomejavascript=1 </code> , which is dynamically generated javascript: if I include the script with <code> esc_url(add_query_arg('apple...
From the Codex entry for Data Validation: URLs : <code> esc_url( $url, (array) $protocols = null ) </code> (since 2.8) Always use esc_url when sanitizing URLs (in text nodes, attribute nodes or anywhere else). Rejects URLs that do not have one of the provided whitelisted protocols (defaulting to http, https, ftp, ftps,...
Difference between esc_url() and esc_url_raw()
wordpress
Hi when i try to <code> get_terms(); </code> in theme options via this code <code> $catalogs_terms = get_terms( 'catalogs' ); $mycatalogs = array( -1 =&gt; 'Select a catalog' ); if ( $catalogs_terms ) { foreach ( $catalogs_terms as $catalog_term ) { $mycatalogs[$catalog_term-&gt;term_id] = $catalog_term-&gt;name; } } <...
As i was mentioning before, it's a case of your term fetching occuring before the taxonomy has been registered. The init action occurs after the theme's functions file has been included, so if you're looking for terms directly in the functions file, you're doing so before they've actually been registered. Here's a port...
get_terms return errors
wordpress
We want the users to re-order the posts on a page similar to pagination but I can't find anything anywhere! It would be great to create a link to a url similar to <code> .../page/2/title/ </code> , <code> title </code> being the new order. Is this even possible?! Found several pagination scripts but none offer this opt...
Adding a rewrite rule with an order part is very easy, if you do it for one site. It would be harder if you want to create a generic solution that works for all installations with all kinds of permalink structures and custom taxonomies. This short example works on a basic install of WordPress 3.1, with no extra custom ...
Sorting archive pages with "pretty" URLs?
wordpress
How can I get all subcategories from a certain category?
Yes, you can use get_categories() using <code> 'child_of' </code> attribute. for example all sub categories of category with the ID of 17: <code> $args = array('child_of' =&gt; 17); $categories = get_categories( $args ); foreach($categories as $category) { echo '&lt;p&gt;Category: &lt;a href="' . get_category_link( $ca...
List all subcategories from category
wordpress
i am creating a frontend dashboard where i need to show all the post by the current user. So i need to show posts with all post status. Mainly published, trashed and the pending. I am now using simple query post but it is returning only the published posts as expected. <code> $query = array( 'post_type' =&gt; 'my-post-...
You can use the post_status parameter: <code> * 'publish' - a published post or page * 'pending' - post is pending review * 'draft' - a post in draft status * 'auto-draft' - a newly created post, with no content * 'future' - a post to publish in the future * 'private' - not visible to users who are not logged in * 'inh...
How to Get All Posts with any post status?
wordpress
Is it possible to specify two usergroups (e.g. admins and editors) into the admin menu capability field ? I tried the following but it doesnt work: <code> add_submenu_page( 'my-top-level-handle', 'Page title', 'Sub-menu title', array('administrator', 'editor'), 'my-submenu-handle', 'my_magic_function' ); </code> error ...
Capability parameter of add_submenu_page() function can only take a single capability, so if you are using the built in roles you can select a capability fro the long list that both administrators and editors have any og these: moderate_comments manage_categories manage_links unfiltered_html edit_others_posts edit_page...
Menu capability in Wordpress
wordpress
I am new to WordPress and I've seen this term passed around.
"Shortcode" is a user friendly way of inserting various WordPress plugins/scripts into a page without having to know a lot of fancy HTML/JavaScript/PHP in order to make it happen. Take, for example, embedding an mp3 file into a post on a hosted WordPress site. Instead of having to setup the proper code for a flash play...
What is a short code?
wordpress
I am using the following code to display a list of posts within a category, but I want to display the title in it's own h2 tag above the list. <code> &lt;ul class="subcats-list"&gt; &lt;?php $weightloss = new WP_Query(); $weightloss-&gt;query('showposts=5&amp;include=4'); while ($weightloss-&gt;have_posts()) : $weightl...
Since you already have the category ID (you use it in your call to <code> WP_Query::query() </code> ), you can just use that to request the category name. <code> get_cat_name( $cat_id ) </code> will do exactly that. It uses <code> get_category( $cat_id ) </code> in the background, which returns the full category object...
How do I get the title of a category in a custom loop?
wordpress
I'm developing a WordPress theme that allows users to toggle the visibility of the sidebars using Javascript in the same way that wikis allow users to show or hide a table of contents. When a user clicks the link to hide a sidebar I have a toggle() javascript toggle function that sets the visibility of the sidebar to "...
While annoying, your plugin is functioning properly. The page completely renders itself first, showing the sidebar, and then the JavaScript code activates to hide the sidebar. The fix for this is to have your PHP code check/grab the user's cookie and set the display's sidebar status accordingly. That way when the page ...
Toggle Sidebar Display
wordpress
I'm creating a series of pages with iFrames embedded in them, but it seems the only way to do this within Wordpress (i.e. using the templating system) is to create pages in the admin end and then create individual templates for each of those pages. Is it possible to hide those pages from the admin without a plugin? I s...
you can use <code> parse_query </code> filter hook to exclude your pages using post__not_in attribute <code> add_filter( 'parse_query', 'exclude_pages_from_admin' ); function exclude_pages_from_admin($query) { global $pagenow,$post_type; if (is_admin() &amp;&amp; $pagenow=='edit.php' &amp;&amp; $post_type =='page') { $...
Hide a page in the admin end without a plugin?
wordpress
I've got a plugin that I ship with my theme whose function is to jumpstart the process of launching site so that its optimized for the theme. It has all my default pages, plugins, settings, etc... For example, I'm using the following script to remove the default blogroll links... <code> $arr_args = array( 'hide_invisib...
Use wp_insert_link() .
Script to replace default blogroll with links to my social media URLs
wordpress
pretty simple. I'm creating a plugin and I want to dynamically insert some text that will change every hour into the line that is directly below the title of a post (So filters are no good). It's the <code> &lt;div class="entry-meta"&gt; </code> . The <code> &lt;div class="entry-utility"&gt; </code> at the bottom of th...
The lines you mention are most likely part of your theme. You will need to either: figure out which functions/templates output them and if they have hooks to use; edit theme (create child theme) to add your own function to output what you want.
Hook for plugin to insert into entry-meta
wordpress
I'm developing a site where better is very quickly becoming the enemy of the good. I would like to make updating as simple for the client as possible by enabling them to populate boilerplate and images text using a shortcode. However, there is one word within the boilerplate text which needs to be unique for each page ...
Not sure I understand your specifics, add details if I am off. I assume: Your shortcode inside post's content. You have custom field in that post with value you want. In this case declare in your shortcode function <code> global $post; </code> and use <code> $post-&gt;ID </code> to retrieve custom field.
Can data from a Custom Field data be used by a shortcode on a per page/post basis?
wordpress
It is highly recommended practice (that I completely agree with) to develop with <code> WP_DEBUG </code> enabled. However it is merely inconvenient to see not yet fixed warnings in pages, but in Ajax responses they ruin response completely. I am just starting with Ajax in WP, is there some appropriate hook to suppress ...
In <code> wp-config.php </code> : <code> if ( defined( 'DOING_AJAX' ) &amp;&amp; DOING_AJAX ) define( 'WP_DEBUG', false ); else define( 'WP_DEBUG', true ); </code>
How to override WP_DEBUG for Ajax responses?
wordpress
I have custom post type called <code> paintings </code> and it has a custom taxonomy called <code> paintings_category </code> . Currently I have this situation: <code> example.com/paintings/ </code> A page using <code> page-paintings.php </code> <code> example.com/paintings_category/landscape/ </code> Lists all <code> ...
Well, it turns out it is indeed possible : ) I eventually found most of the answer in this post: stackexchange-url ("Custom post types, taxonomies, and permalinks.") Then I got <code> single-paintings.php </code> to paginate within selected taxonomy with this plugin: Ambrosite Next/Previous Post Link Plus (which looks ...
custom post type and custom taxonomy url conflict
wordpress
I want to keep a check if the user has a particular password, so I have been trying it with <code> wp_check_password </code> but the account for which it is checked gets logged out and can't login again till there is a call of <code> wp_check_password </code> in the code. Digging into the code, I found out that it sets...
Your example works correctly. You are checking if password <code> hello </code> matches hashed <code> hello </code> - which it naturally does. Hadn't thought it through. Your example causes following issue: You check if <code> hello </code> matches md5 of <code> hello </code> (instead of hash from user's profile). It d...
Check the password of a user
wordpress
I recently updated my site to 3.1 and now the frontend of the site will not load. The weird thing is the admin section does load and is some what functional (sometimes the pages go blank and I have to reload, and sometimes reloads don't work). I had to install and activate a maintenance plugin while I try to trouble sh...
I've had this same issue a couple of times now. Generally I've resolved it by manually downloading 3.1 and replacing the files in the directory. After the transfer is complete I was able to log in and update my database with the drop-down it presented.
Site DOES NOT LOAD after 3.1 update
wordpress
On editing the attachments of a post whith at least one attachment previously uploaded, how do I remove the From computer tab and redirect to the Gallery tab? This is my current code: <code> add_filter('media_upload_tabs','remove_medialibrary_tabs', 99); function remove_medialibrary_tabs($tabs) { if ($post_id = (isset(...
To remove the From Computer tab header , you unset the <code> type </code> key from that array . However, this will (confusingly) not remove the tab content , and because this is the default tab it will show it even if the tab header for it is gone. To change the default tab you must hook into the <code> media_upload_d...
Remove "From computer" media tab for posts with existing attachments?
wordpress
In the course of converting a blog from Blogger to WP and running a script to grab hot-linked images for hosting, I ended up with some funky images names like <code> act%252Bapandas-210x290.png </code> These image names prevent the image from displaying on a webpage, due the url encoding ending up in the file name itse...
General idea would be to loop through all attachments to retrieve, modify and write back their meta. Something like this (test thoroughly before using on anything important): <code> $posts = get_posts(array( 'post_type' =&gt; 'attachment', 'numberposts' =&gt; -1, )); foreach( $posts as $post ) { // retrieve data, unser...
Remove “%” from strings in serialized arrays in wp_postmeta
wordpress
Processing the following form in the admin area, but the database constantly returning an empty cell where the info should be. Help!! <code> &lt;form action="options.php" method="post"&gt; &lt;input type="hidden" value="admin_bar" name="option_page"&gt;&lt;input type="hidden" value="update" name="action"&gt;&lt;input t...
<code> options.php </code> does not automatically save in the database anything that you post to it. You must also tell the page which options it should look for in the posted data. I see that you have set <code> option_page </code> to <code> admin_bar </code> , which is half of the solution. The other half is to add t...
my checkbox is not saving it's value
wordpress
I want to create an affiliate system on WordPress . What I mean is when "Member A" invite other to join (ex. "Member B") by using the ?referralId=MemberA querystring, then Member A get points or credits, and when Member B invite Member C, then Member B get points. Is there any WordPress plugin that can do that ? I alre...
Don't know about a plugin but this can be done easily with just two hooks and callback functions: First you add the refferer field to the registration form using <code> register_form </code> hook: <code> add_action('register_form','show_reff_field'); function show_reff_field(){ ?&gt; &lt;input id="ref" type="text" tabi...
WordPress plugin for affiliate referral system
wordpress
I have a standard Wordpress loop displaying items: <code> $loop = new WP_Query( array( 'post_type' =&gt; 'images', 'orderby' =&gt; 'menu_order', ) ); while ( $loop-&gt;have_posts() ) : $loop-&gt;the_post(); /* loop code, HTML mostly, a few if statements, nothing special */ endwhile; </code> Now I want to display CERTAI...
get_post_meta() function works In and Outside of the loop and you saying that you do see it working on a single image " but doesn't in loop " means that you probably did not add the code to the right loop. To be clear It works with all posts types.
Metadata in loops
wordpress
I've been working with widgets a lot lately and have amassed a ton of widgets in the inactive widgets collection. Can someone share a script or plugin that will remove all inactive widgets from the site?
something like: <code> $widgets = get_option('sidebars_widgets'); $widgets['wp_inactive_widgets'] = array(); update_option('sidebars_widgets', $widgets); </code>
Script to remove all inactive widgets?
wordpress
I randomly get high spikes in CPU and Memory. I have deactivated nearly all plugins trying to find the culprit. I have been turning on a few at a time then waiting 30 minutes to see how if the server says it is okay. Which it always does. I didn't touch it for 3 hours tonight and when I returned I realized that my VPS ...
I think I found what the problem was. WP-Postviews. I deactivated the plugin and removed all code from it on the site and now everything is running smoothly (at least for the last 3 hours).
High CPU & Memory Spikes?
wordpress
Hey all, I'm using Jquery UI tabs with the WordPress Post Tabs plugin and it works like a charm. However, I'd like to auto disable or hide tabs that do not have any data. I've worked with Jquery quite a bit but I'm lost in this mess. Any help would be appreciated. Thanks! Jquery Tabs Information from the official site ...
* See edit history for previous comments I decided i'm going to write a plugin to do this, the plugin discussed i'm sure was written with the best intentions, but the code in my personal opinion needs a total rewrite, which is essentially what i'll be doing. The aim will basically be to emulate the functionality of the...
Disable Jquery UI post tabs
wordpress
I have a loop template called <code> loop-event-details.php </code> where I have code to display each event. My main page template is called <code> events-page.php </code> . I use the following code to include the loop template: <code> get_template_part( 'loop', 'event-details' ); </code> I have also trying this code: ...
I've created a new file, specified the encoding as "UTF-8" and retyped everything by hand - no copy/paste from the old file. Took a while, but all works now. It must have been some encoding errors playing up. Thanks to everyone who helped: @t31os, @kaiser, @Chip Bennett
strange parse error when including a loop template within another template
wordpress
In my WP admin's "Pages" section is a page called "Home" with a URL of /home. This page's content gets called by my index.php file. My problem is the /home page is coming up in search results, or someone could type in /home. Is it possible to redirect /home to index.php (or just "/")?
Change your index.php file back to normal, then set that home page as the front page instead. Then the /home will redirect to / as it should.
Redirect /home to home.php
wordpress
I'm listing all sidebars like that: <code> global $wp_registered_sidebars; echo '&lt;pre&gt;'; print_r($wp_registered_sidebars); echo '&lt;/pre&gt;' </code> So I'm getting something like: <code> Array ( [sidebar-1] =&gt; Array ( [name] =&gt; Sidebar #1 [id] =&gt; sidebar-1 [description] =&gt; Sidebar number 1 [before_w...
Loop through the global: <code> &lt;select&gt; &lt;?php foreach ( $GLOBALS['wp_registered_sidebars'] as $sidebar ) { ?&gt; &lt;option value="&lt;?php echo ucwords( $sidebar['id'] ); ?&gt;"&gt; &lt;?php echo ucwords( $sidebar['name'] ); ?&gt; &lt;/option&gt; &lt;?php } ?&gt; &lt;/select&gt; </code> Note: The <code> ucwo...
List all sidebar names?
wordpress
Running WordPress 3.1 with the free Boldy theme from Site5. Here is a working version of my website: http://www.dekhoforum.com I want to achieve something like this screenshot: i.e. Have a 2nd logo above the social media icons. EDIT - Screenshot shows moving an existing image to the new location. This is misleading, an...
This can easily be accomplished with CSS. Sometimes it's better to use CSS to modify your theme. I use the Web Kit developer tools or Firebug to make live edits in the browser until it looks right then save it back to CSS. Edit the following lines in style.css. <code> /* line 201 pulled down the icons to make room for ...
Boldy Theme - Tweak PHP for 2nd Logo?
wordpress
I have a self-hosted blog, ( Code Repo - Code Snippets ) but for some reason when I search for it on google, it doesn't come up in the results. I posted an entry about 4 days ago, and by now I would have expected it come up in the results. When I search for things on my normal site (same domain), they do come up, its j...
Googling "site:http://dougmolineux.com/wp/" seems to show that you blog is getting indexed and quick check doesn't find any settings prohibitive to indexing set. Other than latter there isn't really much that can be done, it's up to Google how it indexes and serves your site in results.
Self-Hosted Blog on Google Search
wordpress
How can i get the posts using get_posts from let's say post 10 and beyond?So if i have 200 posts i will get from post 10 to post 200(190 posts)? Because as i see if i use <code> &lt;?php $args = array( 'numberposts' =&gt; -1, 'offset' =&gt; 10 ); ?&gt; </code> i just get all the posts Cheers
It's strange, you'd have thought if you disable paging and grab all posts, that you could naturally set an offset to, eg. <code> array( 'nopaging' =&gt; true, 'offset' =&gt; 10 ) </code> or <code> array( 'posts_per_page' =&gt; -1, 'offset' =&gt; 10 ) </code> or <code> array( 'numberposts' =&gt; -1, 'offset' =&gt; 10 ) ...
get_posts from post x(offset=> x) to end
wordpress
I am having a JavaScript which is used for marquee, I want to use this in my wordpress site. But this java script is conflicting with my wordpress, I am using this in footer, but just the <code> div </code> area is getting loaded, the marquee in it is not working. Here is my code: <code> &lt;div class="marq"&gt; &lt;sc...
That script looks very old and obtrusive and it doesn't output a marquee, but a slideshow. There already are hundreads of themes with a slideshow built in, as well as many newer jQuery plugins which you can switch to. If you're still convinced this particular script is worth the time to fix, install Firebug to see the ...
javascript conflict
wordpress
I have my news in posts and I am trying to display the two latest news articles (posts) on my main page. I've got that solved by getting the title using <code> the_title() </code> and getting a little bit of the text using <code> the_excerpt() </code> . I want to show a more... link that takes you to the post. However,...
You can scan the content to see whether it contains a link and then parse it to find the <code> href </code> attribute. There are many ways to do this, this example uses the built-in kses functionality, as demonstrated by Otto : <code> $post_link = get_the_permalink(); if ( preg_match('/&lt;a (.+?)&gt;/', get_the_conte...
Get link value only from the_content()?
wordpress
I'm having an issue with one site in which my plugin is installed. The "settings" page will not load. When I click on "settings", it loads the settings page but the page is blank after the "Upgrade to 3.1" nag div as if there was a die() there. I have two files, plugin.php and plugin-admin.php I've got code in plugin.p...
If i had to venture a guess at the cause of the problem my initial thought would be toward the flush rules call. As Andy said, having debug on helps a great deal, and if you really don't want to see the errors, you can always use the debug log instead, using the following in your config file.. <code> define('WP_DEBUG',...
What could cause my plugin's options/settings page not to load?
wordpress
The admin bar is appearing for non logged-in users on one of my sites, but only for two specific pages (/work and /contact, for what it's worth). Has anyone heard of this happening before? It appears as though one of the site's users is logged in (their username is displayed), but clicking any links on the admin bar le...
Since I think that mis-identifying all users not-logged in is extremely unlikely, my line of thought is that wrong non-public version of page was cached for some reason.
Why is the admin bar appearing (on certain pages) for non logged-in users?
wordpress
I'm facing a strange problem here with this custom login form: <code> &lt;form name="loginformfooter" class="loginform" id="loginformfooter" action="&lt;?php bloginfo('url'); ?&gt;/wp-login.php" method="post"&gt; &lt;input type="text" name="log" id="user_login" class="input" tabindex="1" /&gt; &lt;input type="password"...
Php Short tags are a "no-no" You shouldn't use short php like this: <code> value="http://&lt;?=$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];?&gt;" </code> Where does it come from? Different servers, different php.ini files. You simply ran into the problem that <code> short_open_tag = Off </code> is set. Not all serv...
custom login form redirect problem
wordpress
I am writing a function that adds an ID number to an array and puts the array in the usermeta. $_GET['auction'] is the post_id. Here is the function: <code> $reminders = get_user_meta($current_user-&gt;ID,"reminders"); print_r($reminders); if(in_array($_GET['auction'],$reminders)) { echo "Failed: Auction already in lis...
Haven't used the function for quite a time, but i guess your problem is that you are pushing an array into an array. So check if <code> intval($_GET['auction']) </code> is an array: <code> echo '&lt;pre&gt;'; print_r(intval($_GET['auction'])); echo '&lt;/pre&gt;'; </code> Edit #1: You maybe need to get the value from t...
Problem storing arrays with update_user_meta
wordpress
Let's say I got the following categories: <code> Style | + Shoes + Pants </code> If I make a post and put it in the Style and Shoes category, it will list them alphabetically instead of hierarchically. So it would list it as Shoes, Style instead of Styles, Shoes. How can I do this? I tried using "the_category('> ', 'mu...
You could fetch the post categories, then pass them into <code> wp_list_categories </code> to take care of displaying them hierarchally. Something like.. <code> wp_list_categories( array( 'include' =&gt; array_keys( get_the_terms( $post-&gt;ID, 'category' ) ), 'title_li' =&gt; '' ) ); </code> Hope that helps.. :)
List categories of a post hierarchically?
wordpress
Every time I create a new site under 3.1, my first trip is to the Users > Admin User profile page to uncheck the "admin bar" checkbox. I'd like to place a script in my theme's functions.php to do this automatically. Anyone know what that would be?
You could use a function inside your theme's functions file to selectively disable it for specific users. <code> function disable_bar_for_user( $ids ) { if( !is_user_logged_in() ) return; global $current_user; if( is_numeric( $ids ) ) $ids = (array) $ids; if( !in_array( $current_user-&gt;data-&gt;ID, $ids ) ) return; a...
How to disable 3.1 "Admin Bar" via script for the admin user?
wordpress
I am managing a Wordpress network and would like to add the unfiltered_html user capability to the already predefined user role of Admin. In a standard installation of Wordpress the Admin account would already have this capability but in an MU installation only Super Admins are afforded this capability. Wordpress Roles...
You can use WP_Role class, <code> // get the the role object $role_object = get_role( $role_name ); // add $cap capability to this role object $role_object-&gt;add_cap( $capability_name ); // remove $cap capability from this role object $role_object-&gt;remove_cap( $capability_name ); </code> or you can run this once i...
How to add a Capability to a User Role?
wordpress
Hay, I'm making a WordPress template, and i have 4 main pages. <code> HOME BLOG CONTACT ABOUT US </code> As you can see "Blog" is a page (i need it to display when i call wp_list_pages()), but how do i edit this blog page? I assigned the "Blog" page a custom temeplate (called blog.php), but when "Blog" is set as the "P...
Setting page to be "posts page" changes its template hierarchy to follow home page rules . So your custom template is ignored and it looks for <code> home.php </code> or <code> index.php </code> , which might or might not be the reason it fails to render.
What exactly does "Posts page" do in WordPress?
wordpress
The Dilemma I have a few custom post types: Portfolio Items Testimonials FAQs The URL structures for these custom post types are: mysite.com/ portfolio /name-of-custom-post mysite.com/ testimonial /name-of-custom-post mysite.com/ faq /name-of-custom-post I'd like to use the normal, built-in WordPress post type to contr...
You could do this on custom post type registration. 1) Set your default permalink in the WordPress admin to your desired structure e.g.: /blog/%postname% 2) Add the "slug" and "with_front" parameter to the rewrite-array in the register_post_type function. "slug" must be the name of your post-type. <code> $args = array(...
Possible to change the URL for the regular post type without affecting the URL of other custom post types?
wordpress
I've got a very basic solution using <code> fetch_feed() </code> and SimplePie to pull in RSS items which is working on my localhost, but for some reason <code> is_wp_error() </code> persists as <code> true </code> on the live server. Is there anyway for me to get specific output about the nature of the error so as to ...
add this to your feed <code> $rss = fetch_feed( $url ); if ( is_wp_error( $rss ) ) { echo $rss-&gt;get_error_message(); &lt;---this } else { // do your stuff here } </code> I would also suggest installing the debug toolbar extensions, like "debug-bar-extender".
Troubleshooting fetch_feed and SimplePie
wordpress
I have my blog under <code> blog.mydomain.com </code> . I am using pages for some static content that needs to be accessed from another subdomain. So <code> careers.mydomain.com </code> will show WordPress content from <code> blog.mydomain.com/careers </code> . My problem is that all the links on the page still referen...
There is a filter, <code> post_link </code> , that permalinks pass through before being returned from <code> get_permalink </code> in <code> wp-includes/link-template.php </code> . You can use that filter to alter the links. However, beware that making all permalinks relative may have unintended consequences in certain...
Relative instead of absolute links in pages?
wordpress
My blog is painfully slow for the last few days, and I would like to pay someone (anyone?) 15 BitCoins to optimize it for me (I would do it myself, but I'm not sure I have the time right now). It's currently hosted at GoDaddy. What I'm thinking is giving him a snapshot of the filestructure of my blog, and asking him to...
Yes, there is a risk! I can put up a check on date to change your password, create a new user and what not. Don't give access to someone you don't trust. Hire a professional to do the job. Edit: Okay! Upon request, I have explained two cases in a blog post - http://blog.ashfame.com/?p=903
Is there a security risk giving someone temporary access to my blog's code?
wordpress
I created a new post-type following this technique: (http://www.wpbeginner.com/wp-tutorials/how-to-use-custom-post-types/) After creating a a new post-type some of the feature of the a regular post also disappeared. I installed a plugin (SEO Pressor) that helps my seo on creating a new post. That plugin can be seen in ...
The plugin would need to support custom post types. You might be able to ask the plugin developer to add that. The custom post type API's are fairly new and still don't have widespread support. You can see that they are adding the meta boxes only for posts and pages: <code> add_meta_box( 'WPPostsRateKeys-Keyword', 'SEO...
new post-type how do i retain the plugins on my sidebar?
wordpress
I have this code which is located on the search.php page and retrieves all the categories for each post and echo's out a link to the first category: <code> $category = get_the_category(); //print_r($category); if ($category) { echo '&lt;a href="' . get_category_link( $category[0]-&gt;term_id ) . '" title="' . sprintf( ...
got a result on stack overflow which worked spot on thanks to @poelinca. code is below incase anybody else has the same issue: Add this function in you're theme/functions.php file : <code> function get_deep_child_category( $categories ) { $maxId = 0; $maxKey = 0; foreach ( $categories as $key =&gt; $value ) { if ( $val...
get_the_category and echo out link to child-most/deepest category
wordpress
I'm trying to add template page from a plugin,and my template page is in this plugin folder.Is this posible?Here is my code: <code> global $user_ID; $new_post = array( 'post_title' =&gt; 'Test Template Page', 'post_content' =&gt; 'Some text', 'post_status' =&gt; 'publish', 'post_date' =&gt; date('Y-m-d H:i:s'), 'post_a...
The article linked is on the right track, but i'll make it more simple for you.. ;) <code> add_filter( 'page_template', 'catch_plugin_template' ); function catch_plugin_template( $template ) { if( 'tp-file.php' == basename( $template ) ) $template = WP_PLUGIN_DIR . '/yourpluginname/tp-file.php'; return $template; } </c...
Add custom template page programmatically
wordpress
My code lists the child pages ordered by post title, pulling through the first image attachment of the child post as the thumbnail. The child pages contain custom fields created using the Magic Fields plugin. Can anyone help me adjust my code so that I can have my pages listed in descending order of a custom field call...
I tested this code and it works great: <code> &lt;?php query_posts('meta_key=price&amp;orderby=meta_value_num&amp;post_parent='.$post-&gt;ID.'&amp;post_type=page'); ?&gt; &lt;?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?&gt; &lt;div class="page" id="post-&lt;?php the_ID(); ?&gt;"&gt; &lt;div class="...
Change Page Order by Custom Field (Magic Fields)
wordpress
how are you ? In my website I want to make the author's page and category(slug of it is country) to be in google reslut .. like this : http://rehlat-world.com/profile/saqaf , but when I search in google : site:rehlat-world.com , I didn't find authors page. how can include authors page in google result , this is my robo...
The problem is that your author pages are marked with the noindex tag, look at the page source: It must be a plugin that is doing that, that is not the default setting. If you don't want the duplicate pages, try a plugin like Yoast WordPress SEO that let you add Nofollow to comment links.
I have two problems ( SEO )
wordpress
I'm working on a site that is going to be community powered. It's going to have the form for registered users to submit draft posts, which will then be approved or deleted by the site's editors. The way I'm trying to implement it is with a custom page template, which includes a form that will allow people to submit dra...
http://voodoopress.com/2011/03/how-to-post-from-your-front-end-with-no-plugin/ I just finished a series of posts on it. Making the form work, adding custom meta boxes, adding images. Everything works on it (except validation). I'll be getting the validation thing figured out better soon. But the code I share is gleaned...
Front End Post Submit Form
wordpress
OK, there have been several posts on here about frontend posting forms. I've read them all, which got me to where I am. Now every form I come across has some form of validation which seems to check for a value for the fields you want to make required. I've tried them, and I can't get anything to work. I just can't make...
The best way to do form validation is with a combination of JavaScript and PHP. The reason why you want to perform JavaScript validation is to give the users a chance to correct their errors without submitting the form. Plus, it will stop any casual mistakes. You will also want to ensure validation on the back-end in c...
Frontend Post Form Validation
wordpress
I'm working with a blank theme and my nav.php looks like this <code> &lt;div class="navigation"&gt; &lt;div class="next-posts" style="float: left;"&gt;&lt;?php next_posts_link('&amp;laquo; Older Entries') ?&gt;&lt;/div&gt; &lt;div class="prev-posts" style="float: right;"&gt;&lt;?php previous_posts_link('Newer Entries &...
Maybe my (edu) plugin can help you understanding the ways that are possible to display pagination a little better. I updated it after reading your Q. You can now more easily style your links. Just add your buttons as background-images to the stylesheet.
adding images to wordpress pagination?
wordpress
I have a main page that consists of 7 categories being output by wp_list_categories, each li specifically includes one ID. These categories are directed to a category-page.php specifically built for each category. Now, each category has sub categories. So on each of the category pages, I want to build out custom querie...
I figured this out on my own. I use the code below and duplicated it as many times as I needed without any issues so far. If anyone thinks this is incorrect than please comment. I was not using the main loop anywhere else on this page and used WP_Query. <code> &lt;ul class="subcats-list"&gt; &lt;?php $weightloss = new ...
Creating mulitple loops in a sub-category page
wordpress
I'm using <code> admin_footer-{$hook_suffix} </code> to selectively print scripts on the new post page and comments page. This hook is depreciated in 3.1. I see there's an <code> admin_print_scripts-{$hook_suffix} </code> but this does not print to the footer, rather to the header before any jQuery or other stuff is lo...
There's an <code> in_footer </code> parameter that you can pass to wp_enqueue_scripts - does that work? I would hook to <code> admin_enqueue_scripts </code> , check the $page for location, and enqueue your script there, with 'in_footer' as true. Example: <code> add_action( 'admin_enqueue_scripts', 'enqueue_my_script' )...
How can I selectively print scripts to the footer of certain admin pages?
wordpress
When creating a new post, by entering either manually or pasting from another document, TinyMCE (the default WordPress editor) does not seem to hold any type of formatting. For instance I create a two paragraph entry. When viewing it on the page it will come through as a single chunk of text within <code> &lt;div class...
TinyMCE - at least, as-configured for WordPress - isn't explicitly designed for copying/pasting of text richly formatted in other word processors. That said: how are you pasting? Are you simply copy/pasting (i.e. via CTRL-C, CTRL-V; or else via right-clicking and using contextual menu commands), or are you using the "P...
Wordpress no longer holding post formatting
wordpress
I have a custom metabox made using the code from Wordpress Reference: http://codex.wordpress.org/Function_Reference/add_meta_box <code> &lt;?php /* Define the custom box */ // WP 3.0+ // add_action('add_meta_boxes', 'myplugin_add_custom_box'); // backwards compatible add_action('admin_init', 'myplugin_add_custom_box', ...
there is you answer, in your code where it says: // Do something with $mydata probably using add_post_meta(), update_post_meta(), or a custom table (see Further Reading section below) you need to actually insert/update the data to the database so add something like: <code> global $post; update_post_meta($post-&gt;ID, '...
Getting metabox value?
wordpress
So, I've read through stackexchange-url ("this question") about licensing of PHP code under the GPL v2. As well as the compromise of the Thesis theme developer, as far as licensing all PHP under the GPL, but copyrighting js, css, images, etc. My question is does ALL php have to be GPL? Consider this scenario: the php t...
The data generating PHP, if it truly stands alone and doesn't use any WordPress code or WordPress' data layer, can be licensed as a standalone library. You can use any license you want here without any problems. The only issues come when you start distributing your code. If you want your theme hosted in the theme repos...
Premium theme licensing of php called through AJAX
wordpress
hey guys, quick question. I'm using jquery for my current project (the latest release). A few plugins I'm using are using jquery as well and they are inserted through wp_head(). Since I want my website to ber fairly slim and fast this redundant scripts should be removed. is there any way I can filter for the string "jq...
There's no filter that covers the entire output produced during wp_head(). You would have to use a fairly complicated process of output buffering starting before wp_head, then filtering out what you don't want afterwards, before releasing the buffer. Lets assume that you're dealing with plugins that have registered the...
wp_head() remove redundant scripts?
wordpress
<code> wp_list_pages('title_li=&amp;depth=&amp;exclude='); </code> lists all pages of my site. If there are childpages of a certain page the output looks like this: <code> &lt;li class="page_item page-item-2"&gt; &lt;a href="http://domain.com/about" title="About"&gt;About&lt;/a&gt; &lt;ul class="children"&gt; &lt;li cl...
you can use get_pages() function, something like this: <code> $mypages = get_pages(); echo '&lt;ul&gt;'; foreach($mypages as $page){ echo '&lt;li class="page_item page-item-'.$page-&gt;ID.'"&gt;&lt;a href="'.get_page_link($page-&gt;ID).'"&gt;'.$page-&gt;post_title.'&lt;/a&gt;&lt;/li&gt;'; } echo '&lt;/ul&gt;'; </code>
list child-pages as normal pages?
wordpress
hey guys, weird situation... I'm trying to use wp_ajax() for the first time. I'm normally using a normal jQuery ajax request but in my current case I get a lot of bugs so I thought about trying wp_ajax(). I don't get it though! The following piece of code... <code> // embed the javascript file that makes the AJAX reque...
Ok, firstly let me just break it down a little, so you understand the purpose of these functions. wp_enqueue_script() Description: A safe way of adding javascripts to a WordPress generated page. Basically, include the script if it hasn't already been included, and load the one that WordPress ships. wp_localize_script()...
wp_ajax() question.. not using wp_enqueue_script?
wordpress
I'm looking for a way to pull in photo albums from a Facebook Fan Page into a Wordpress site and have the photos open up in a Lightbox with Facebook comments. I've found a few plugins but nothing quite like what I'm looking for and I haven't seem any with comments. Anyone know whether this is possible? Thanks
I use Facebook Photo Fetcher to share all photos from my facebook fan page to wordpress(organizing by Album is not yet available). It works well except you need to refresh the code after every upload of new photos to facebook fan page, it's not automatic. Unfortunately for me, This plugin doesn't do what I want it to d...
Display Facebook photo albums and photo comments?
wordpress
I've come across a small bug with my yoast breadcrumbs. I've rebuilding a site and have imported some old posts and content and have come across a problem where yoast things the permalinks are still the old ones. I've flushed out all the old categories and tags, etc and have used flush_rewrite_rules() to try and fix it...
There seems to be a bug in the Yoast Plugin, which was fixed by switching on to the NavXT Plugin to do breadcrumbs instead.
Posts picking up old Permalinks, how to reset?
wordpress
Is it possible, to search just for tags? Not any other taxonomies or post types, just tag titles.
Yes its very possible, you just need to create your own search form and processing function form: <code> &lt;form name="tag-search" method="POST" action=""&gt; &lt;input type="text" vlaue="" name="tag-q" id="tag-q"&gt; &lt;input type="submit" name="tag-submit" id="tag-submit" value="Search Tags"&gt; &lt;/form&gt; </cod...
Search for tags
wordpress
I noticed ShareDaddy has "Show sharing buttons on this post" for default post types but not for custom post types. I'm guessing I need to add something in <code> 'supports' =&gt; array('title','editor','thumbnail') </code> . Does anybody know what I need to add in order for "Show sharing buttons on this post" to show u...
ShareDaddy uses two filter hooks either <code> the_content </code> or <code> the_excerpt </code> this means that your custom post type theme template file has to use one of these two functions <code> the_content(); </code> or <code> the_excerpt(); </code> . Update Ok I guess i didn't get the question. So to add the met...
Jetpack plugin (ShareDaddy): Prevent share buttons showing on custom post types?
wordpress
The original urls for users look like <code> /author/login/ </code> Is it possible to replace login by user's id? In my dream urls should become to <code> /users/34/ </code> (34 is user id). Thanks.
you need 3 simple functions and hooks first change the author base: <code> //change author/username base to users/userID function change_author_permalinks() { global $wp_rewrite; // Change the value of the author permalink base to whatever you want here $wp_rewrite-&gt;author_base = 'users'; $wp_rewrite-&gt;flush_rules...
Change author permalink
wordpress
I heard many times, that WordpPess's search doesn't work good. Are there any other search engines available for wordpress? I know about sphynx, seems its a good one, but available plugins are out of date. Thanks.
WordPress › Relevanssi - A Better Search « WordPress Plugins Key features: Search results sorted in the order of relevance, not by date. Fuzzy matching: match partial words, if complete words don't match. Find documents matching either just one search term (OR query) or require all words to appear (AND query). Search f...
How to improve WordPress search
wordpress
I have modified the buddpress admin bar by creating the following plugin which adds a simple text link to the bar: <code> function bp_adminbar_currentsite_menu() { global $bp; ?&gt; &lt;li&gt; &lt;!-- Insert your link url or relative url, and your link text below --&gt; &lt;a href="http://EXAMPLE.COM"&gt;EXAMPLE LINK T...
You ca use the conditional tag <code> is_admin() </code> to check if you are on the front-end or back-end like this: <code> function bp_adminbar_currentsite_menu() { global $bp; if (!is_admin()){ ?&gt; &lt;li&gt; &lt;!-- Insert your link url or relative url, and your link text below --&gt; &lt;a href="http://EXAMPLE.CO...
modify buddpress adminbar only in admin pages
wordpress
I have Wordpress 3.1 installed in a subdirectory of a shared hosting account, it's a linux server and mod_rewrite is enabled and working fine elsewhere. The contents of the .htaccess file disappear whenever I try and change the permalinks structure, leaving just the begin/end wordpress comments with nothing in between....
By default, this shouldn't be happening. My guess is that this is an oddity with your hosting provider. I would also guess that the <code> .htaccess </code> file is world writable. I would try making the <code> .htaccess </code> file mode <code> 644 </code> like so: <code> chmod 644 .htaccess </code> or by using your S...
Wordpress 3.1 .htaccess contents keep dissappearing?
wordpress
I'm using <code> &lt;?php the_date('l jS F Y','&lt;h2&gt;','&lt;/h2&gt;'); ?&gt; </code> inside the loop in order to group/sort posts by date. This all works great but I would like to add a different class to the last post for each date, effectively seperating each date section. Does anybody know how to do this please?...
Its possible, you can get the next post date to compare using get_adjacent_post function change your code to this: <code> &lt;?php while ( have_posts() ) : the_post(); //hold current date $curent_date = $post-&gt;post_date; //fix the format to YYYY-MM-DD $curent_date = substr($curent_date,0,strpos($curent_date," ")); $...
Adding a class to last post in the_date
wordpress
we have set up a custom post type under the heading of custom post type along w/two custom taxonomies. (the following code has been added to our functions.php page:) add_action('init', 'create_seminar_post_type'); function create_seminar_post_type(){ register_post_type('seminars', <code> array( 'labels'=&gt; array( 'na...
For the dashboard post listing bit.... http://codex.wordpress.org/Plugin_API/Action_Reference/manage_posts_custom_column <code> // ADDS EXTRA INFO TO ADMIN MENU FOR PRODUCT POST TYPE add_filter("manage_edit-ve_products_columns", "voodoo_prod_edit_columns"); add_action("manage_posts_custom_column", "voodoo_prod_custom_c...
showing custom taxonomies w/custom post type
wordpress