question stringlengths 0 34.8k | answer stringlengths 0 28.3k | title stringlengths 7 150 | forum_tag stringclasses 12
values |
|---|---|---|---|
I have a blog that I have a FB comment box. When I post the blog Its also sent a blurb about the blog to the fan page and then database the post id with the post. But is it possible that when a user posts a comment in the FB comment box I can also have that post as a comment to the actual post on the fan page? | I believe the new Social plugin takes care of that. Let me know if it works. | FB Comments box post to wall? | wordpress |
I'd like to keep the javascript and css styles used by my widget inside their own files (and not add them to the theme). But i can't seem to get wordpress to add them when the widget is actually used on a sidebar. I've tried this: inside the Class declaration, i've added 2 functions <code> class EssentielleRubriquesPos... | <code> wp_print_scripts </code> and <code> wp_print_styles </code> hooks are fired way before your widget function so that is way it's not working. A solution to that would be to include the scripts in the footer using <code> wp_print_footer_scripts </code> hook, take a look at stackexchange-url ("Jan's answer to a sim... | How to load Widget javascript + css files only if used? | wordpress |
I'm trying to show all the posts associated with a Taxonomy (not a term) but it seems to not work. <code> <?php $args = array( 'post_type' => 'projects', 'tax_query' => array( array( 'taxonomy' => 'clients', 'terms' => 'Unilever' ) ) ); $the_query = new WP_query(); $the_query->query($args); if($the_qu... | You haven't specified the 'field' value e.g. <code> 'field' => 'slug', </code> http://codex.wordpress.org/Class_Reference/WP_Query#Taxonomy_Parameters | Query all posts under one taxonomy? Why is my code not working? | wordpress |
I have my own "Recent Posts" menu, but its not currently implemented as a Widget. I'm just including it in sidebar.php. I had to "roll my own" so to speak in order to filter the menu of certain categories whose posts I don't want to appear in the menu. Would it be possible, via functions.php, to filter the default "Rec... | Unfortunately there is no filter for <code> WP_Query </code> args in <code> WP_Widget_Recent_Posts </code> class, so it's impossible. I think there are plugins for recent post that have category filtering option - http://wordpress.org/extend/plugins/tags/recent-posts | Can "Recent Posts" widget be filtered by functions.php? | wordpress |
<code> (function($) { $(document).ready(function(){ /*$('body').css('position','relative'); $('body').animate({'left':'-9999px'},3000);*/ alert('hello'); }); }(jQuery)); </code> Tried also <code> $(document).ready(function(){ /*$('body').css('position','relative'); $('body').animate({'left':'-9999px'},3000);*/ alert('h... | Are you sure the jQuery library is loaded on your page? The error you're getting implies it isn't. View the source and search for jQuery. Then try adding this some where in your functions.php (or plugin) file and see if your script works. <code> <?php add_action( 'wp_enqueue_scripts', 'wpse30127_enqueue' ); function... | Jquery not working | wordpress |
By default WP links to a category like this, mydomain.com/category/travel. Having the word "category" appear in the URL seems unnecessary. I'd prefer have the link read mydomain.com/travel. How can I remove "category" from the URL structure? I don't want to replace it with something else as I can do by entering a new C... | Many plugins take care of that. The one i prefer is Yoast Wordpress SEO plugin , as it does a lot of good things to your blog in terms of SEO. | How do I get rid of "category" from my URL structure? | wordpress |
I know I can publicly show future posts in a loop using <code> 'post_status' => 'future' </code> in WP_Query. But clicking on a future post's permalink will result in a 404 if you are not a logged-in user. Suppose I have a post called Apocalypse in the post_type 'event', scheduled for 12-12-2099. The permalink is my... | In short, you can make future posts visible by telling Wordpress to mark them as <code> 'published' </code> instead of <code> 'scheduled' </code> . You do this by using a <code> future_post </code> hook, which gets called when a post changes status. Each post type automatically gets its own future hook; since the custo... | Make future posts visible to the public—not just within WP_Query | wordpress |
I have a widgetized area and I am trying to add a new widget that can be added to my widget area, I need the code below to be the widget output <code> <ul> <?php $args = array( 'taxonomy' => 'post_tag' ); $terms = get_terms('post_tag', $args); $count = count($terms); $i=0; if ($count > 0) { foreach ($ter... | I got it working now with the code below, not sure if it is the best way but it works good <code> /** * Tag LIST widget class */ class WP_Widget_Tag_List extends WP_Widget { function __construct() { $widget_ops = array('description' => __("Your most used tags in List format")); parent::__construct('tag_list', __('Ta... | Register new widget | wordpress |
I have a slideshow in a custom theme I am developing and I am using the UpThemes Framework, what I want to know is, is there a way and image will only display if it has been defined? For example, at the moment the max. number of images in the slideshow is 6, but if only 5 are uploaded the "alt" attribute displays for t... | If you're wanting to output based on the option being defined , then use <code> isset() </code> . e.g. this: <code> <?php echo $up_options->slideshow6; ?> </code> ...becomes this: <code> <?php if ( isset( $up_options->slideshow6 ) ) { echo $up_options->slideshow6; } ?> </code> EDIT How would I get ... | Only show theme option if it option exists | wordpress |
I was looking for some decent syntax highlighting plugins to display php code on posts. But most of the plugins in the wordpress repository are not updated for years. I found wp-syntax causing issues with the theme. So is there any good plugin with less bugs and better syntax highlighting that works fine with wordpress... | I use SyntaxHighlighter Evolved on my site which is based on Alex Gorbatchev’s SyntaxHighlighter and used by WordPress.com blogs/sites to get something like this: And i just recently published a plugin named Simple Gist Embed This Plugin allows to embed GitHub Gist to your posts/pages/custom using a simple shortcode an... | Syntax Highlighting Plugins and 3.2.1 | wordpress |
Suppose I create a WP plugin that includes a couple of SWFs that I create (not third-party SWFs). According to http://wordpress.org/extend/plugins/about/ , if I want to publish that plugin on wordpress.org I have to release it as GPLv2 or compatible. The first question is more theoretical: Do I have to release the sour... | If you release your plugin with the SWFs embedded, they do in fact need to be released under a GPL-compatible license. This means you need to make the original source for the SWFs available, but not necessarily in the plugin itself. You have two options: The WordPress Way When WordPress includes a third-party tool or l... | Licensing: Can I include SWFs without source in a plugin released on wordpress.org? | wordpress |
What's the best way of doing this: On The 'Media Library' page, I would like a link next to 'View' (the 'View' that appears when you hover over a Media item) for 'Download'. The 'Download' hyperlink would link directly to the file, unlike the 'View' link which links to a template-based page with either the embedded ima... | Modified version of a piece of code found in this tutorial . <code> add_filter('media_row_actions', 'wpse_30159_qe_download_link', 10, 2); function wpse_30159_qe_download_link($actions, $post) { /* Almost sure this is not necessary. Just in case... */ global $current_screen; if ( 'upload' != $current_screen->id ) re... | Inserting a Download Link in the Quick Edit Actions of the Media Library? | wordpress |
I have installed a widget so that I may add testimonials. This widget cycles through the testimonials in the sidebar and everything is fine. What I now want to do is create a testimonials page that retrieves all the entries from this widget. The functionality already exists in the widget to retrieve all the testimonial... | Build a custom sql query that selects the latest testimonials from the table that the plugin creates. Use $wpdb-> get_results($sql_query) to get the results as an array, and then loop over it in your markup. | How do I create a template page with a specific widget as the content? | wordpress |
When I use wordpress on PC, I can simply press ctrl+1 for Heading1 and ctrl+2 for heading 2... But when I use my mac it doesn't work. What are the shortcuts for heading styles on safari? | Short answer- there aren't any. If you click the help button in the editor, then the hotkeys tab, you'll see the available shortcuts for the current OS/Browser. In OS X the modifier is Command instead of Control, but there aren't any shortcuts for headings. | Keyboard shortcut for headings on safari | wordpress |
How to make that google wont follow these two pages: http://mysite.com/products-page/your-account/ http://mysite.com/products-page/checkout/ Thanks! P.S. Im using worpdress with WP Ecommerce plugin. | You can do two things: Create a sitemap.xml excluding the pages you just mentioned. Create a robots.txt which disallows the Google robot from looking at certain files: To exclude all robots from parts of a server: User-agent: * Disallow: /product-page/checkout This is not WordPress specific. HTH | How to make that google wont follow some of the wordpress pages? | wordpress |
I've been searching for a code snippet that lets me limit the title length similar to what you can to with the_excerpt and then just display "(...)" if the title is too long. I'd like to use that in loops outside of single.php, e.g. in my sidebar where an extremely long title would harm the layout. All I could find was... | This depends 100% on how you're getting the title. If you're using a global object (i.e. <code> $post->post_title </code> then you're not passing it through any filters and you'll have to use some fancy post-processing to pare the title down. However, if you're inside a post loop, use either <code> the_title() </cod... | Set max title length - similar to excerpt length for outside of single.php | wordpress |
I downloaded a free theme and I changed everything except the footer I can't change it. I opened the file footer.php and there was only written as shown: <code> </div><!-- /content-wrapper --> <div id="footer"><?php wp_footer(); ?> <ul id="footer-nav"> <?php wp_list_pages('title_li=&... | The <code> wp_footer() </code> function is a WordPress hook. It allows plugins to place additional content at the bottom of the page - this is very useful if you're installing tracking scripts like Google Analytics. But that function is not what is adding copyright information or other junk usually bundled with free th... | How do i change the footer? | wordpress |
in my theme I want to define a series of custom post types and custom taxonomies, each one having its own customized slug; the base language of my theme is english, therefore the slugs will be in English language for example while defining the slug of custom post type "product" args: <code> 'rewrite' => array( 'slug... | I wouldn't try to localize your slugs. Instead, why not give your users the option to change them by adding another field to the permalink settings page? Hook into <code> load-options-permalink.php </code> and set up some things to catch the <code> $_POST </code> data to save your slug. Also add a settings field to the... | Theme localization of "slugs" (custom post types, taxonomies) | wordpress |
I am looking for a website, or a way to find and download all Wordpress.com available themes for my WPMU website. I have searched for some on http://wordpress.org/extend/themes/ but they don't seem to be there. So do you know any repo or list with those themes listed and links to download them? | You can from now on download all free themes on wordpress.com . On theme's page look for "Download [name] for your self-hosted WordPress site" link in sidebar, under "Stats & Info". Konstantin Obenland announced that in a tweet today . | Download all Wordpress.com available themes, somewhere? | wordpress |
I would like to filter <code> wp_generate_tag_cloud </code> so each of the tag links include the slug as a class. More specifically, I would like to output "tag-" + the tag slug. Currently what is assigned as the class is "tag-link-" + the tag ID. The the end, I would happy with either a replacement or just adding this... | one possible way: add a filter in functions.php of your theme: <code> add_filter ( 'wp_tag_cloud', 'tag_cloud_slug_class' ); function tag_cloud_slug_class( $taglinks ) { $tags = explode('</a>', $taglinks); $regex = "#(.*tag-link[-])(.*)(' title.*)#e"; foreach( $tags as $tag ) { $tagn[] = preg_replace($regex, "('$... | display tag slug as class per link in tag cloud | wordpress |
Trying to query pages based on the category they are associated with. I am passing in the cat_ID, but it doesn't seem to be working. Always returns a single post with the title "Hello World" while there is an actual page with real title associated with this category. <code> // The Query query_posts('cat='.$current); //... | It's because the default query is only querying for post_type post, you have to explicitly add page to get it to also query for pages: <code> $args = array( 'cat' => $current, 'post_type' => array( 'page', 'post' ) ); query_posts( $args ); </code> | Query pages by category | wordpress |
A friend's heavily customized blog has a category with a specific <code> categoryname-single.php </code> file to display posts. Apparently for no special reason, since yesterday, <code> the_content() </code> is not returning any content any more for posts in that category, even though the WP back-end is clearly showing... | Is there any way to output the raw, unfiltered post HTML to find out whether this is a rogue filter deleting all the content in that specific category for some weird reason? Yes there is, you can use <code> $post->post_content </code> . Try adding something like: <code> echo '<pre>'.$post->post_content.'<... | the_content() returning null in one category only, even though there is content | wordpress |
Is it possible to display related posts from same category as the current post? | one possibility: <code> $related = get_posts( array( 'category__in' => wp_get_post_categories($post->ID), 'numberposts' => 5, 'post__not_in' => array($post->ID) ) ); if( $related ) foreach( $related as $post ) { setup_postdata($post); /*whatever you want to output*/ } wp_reset_postdata(); </code> http://... | How to display related posts from same category? | wordpress |
I am creating a series of WP child themes which are dependent of a parent theme which I will be using as a framework. I need to have these themes (both parent and children) localized. from http://codex.wordpress.org/Function_Reference/load_theme_textdomain I understood I need to add the following to my theme: <code> ad... | Child themes should use <code> load_child_theme_textdomain() </code> . You can find it in <code> /wp-includes/l10n.php </code> . Use a new slug and a separate po file. | Localization: Textdomain of Child teme | wordpress |
I'd like to use WP to manage my whole site, not just the blog. I don't want the blog to appear on the home page, but instead at mydomain.com/blog. What I've done so far under Settings/Reading is to change the "Front page displays" from the default of "Your latest posts" to the other option, "A static page". So that all... | Check out the Codex , specifically step 2. What you need to do is create a new page, name it "Blog". Make sure the permalink is http://xxxx.com/blog . Then, in Settings > Reading, select that page as your posts page. | How do I get posts to appear at mydomain.com/blog? | wordpress |
I'm new to wordpress and modifying the code that's already working on a website. I want to get user's ID but I haven't figured out yet how. The following sample code works on my local environment but it only returs 0 for a user ID on the production site. Any idea would be appreciated. <code> <?php $docroot = "/home/... | <code> wp_get_current_user() </code> is actually just a wrapper for <code> $current_user </code> and <code> get_currentuserinfo() </code> , so you can use both. It's important, though, to only call it on or after the <code> init </code> hook. Calling it before will only return 0, as you've experienced. | wp_get_current_user always returns 0 | wordpress |
My WP blog has 12 categories, 80 subcategories. I need to fetch the latest post from each of those 12 categories. I know how to do it in 12 queries using 12 get_posts() but is there a way to get them in one query? I tried to make it work like this but it fetches more than 12 posts: <code> // Get array of categories (le... | Quantity of queries isn't the only measure of performance, an individual query can cost more than numerous simple queries. The cost of (small query) x12 < cost of large query x1 + string/array manipulation You would be better doing the 12 individual queries. If it is costly, store the result in a transient for a lat... | get all categories' latest post in one query | wordpress |
Currently I use /%category%/%postname%/ as my permalink structure. However, I would like to have a different structure for different categories. This is because I have a "News" blog that I would like to have organized by date like this - /2011/10/02/. But I have other categories where I do not want a date structure at ... | This is probably not possible or it would require some really scary and fragile hacks. Use a custom taxonomy for the news or a custom post type instead. Setting a different permalink structure for these is much easier. You should find enough examples on our site. | Permalinks - Different structures for different categories? | wordpress |
I would like to make my blog fully integrated with social networks. This mean: * Login via facebook / twitter Share to facebook / twitter Include open graph data in the page any other suggestions I've tried: Twit Connect but if you enable showing of tweet button under posts, it is included under pages too. ShareThis - ... | Not knowing any one-shop-for-all plugin type, but for Facebook, you can try the Simple Facebook Plugin by Otto. This plugin let you enable the single features that you require for your blog, including registering via FB, login via FB, post to your wall... OpenGraph... etc. | Social network plugins for Wordpress | wordpress |
I'm in the process of building out a search page to perform a query on a custom post type and its associated meta and taxonomy. Eventually, I would it to query multiple taxonomies as well as compare values to those in the meta (ie - find posts with foo between X and Y). I have a pretty good understanding of the query f... | You mention that with your first attempt you get the URL http://sitename.com/?brand=22 which is correct as you've used a get method, but you don't say what code you're using for the query. Personally I use this for my form and would agree with wdalhaj to use post instead of get <code> <form id="brandsearch" method="... | Passing form inputs into multi-taxonomy query | wordpress |
If I wanted to show a slider on the home page only, is it better or does it make a difference if I: use a PHP if/then statement and echo a division and markup, or use CSS along with a body class and display none the division? or a combination of both What's the best practice? | target homepage only with if statement. <code> if ( is_front_page() or is_home() ) } </code> if your home page has page/2 page/3 then use the following to display the slider on only page 1 of the homepage. <code> if ( is_front_page() or is_home() && ! is_paged() ) { } </code> | Conditional Tags and Echo HTML / divs or CSS and Display: none? | wordpress |
Is it possible in wordpress to display comments and comment form on custom post type, and how to do that? Thanks in advance. | 1) add "comments" to the supports array when registering the post type. 2) add the comments_template() function inside the loop of the single.php template and you are good to go. | How to display comments and comment form on custom post type? | wordpress |
I have peculiar requirement. The author.php template is used as a profile page for the author where he can view his own posts and posts by other authors. This template has two custom loops to achieve this. The first loop is for displaying post by the author himself, whose profile is being viewed. So if the URL reads "h... | First: why abuse the <code> author.php </code> template file in this way? I would suggest that you consider creating a custom Page template for this output. Second: if you're using multiple queries , it would probably be helpful to give each query a unique variable . (Personally, I would give each query a descriptive v... | Pagination for multiple queries for different authors on author.php | wordpress |
Is it supposed to? My code: <code> if ($_POST && $_FILES) { $tmp_name = $_FILES['file']['tmp_name']; $item = $_FILES['file']; $uploads = wp_upload_dir(); if (is_writable($uploads['path'])) { if (!empty($tmp_name)) { if ($tmp_name) { $overrides = array('test_form' => false); $file = wp_handle_upload($item, $o... | To list uploaded file in the media library use wp_insert_attachment | wp_handle_upload() does not list uploaded file in the media library? | wordpress |
Full disclosure, PHP and Wordpress are not my specialties. I've got this plugin here -> http://wordpress.org/extend/plugins/ustream-status/ that adds a Widget that will show if my Ustream.tv channel is on the air or off the air. The widget itself has fields where I enter my channel name so that it can check it for me. ... | The correct "WordPress" way of doing it would be to use the_widget template tag to display widgets anywhere you want. so in you case you would something like this: <code> $instance['account'] = 'account name'; //Ustream channel name $instance['online'] = 'http://www.online_image.URL'; $instance['offline'] = 'http://www... | Plugin is a widget, but I want to call it in the head, can I? | wordpress |
Hello I need to have the following code on a specific page: <code> <div class="searchbar" > <div class="searchbar-inner" > search <input type="text" id="search" /> <span class="result-count" ></span> </div> </div> </code> Is it possible that I use a shortcode to place it on the... | Assuming you don't have the shortcode written down... <code> function search_shortcode() { $struct = '<div class="searchbar" ><div class="searchbar-inner" >search <input type="text" id="search" /><span class="result-count" ></span></div></div>'; return $struct; } add_shortcode(... | Placing tags on wordpress visual editor using shortcodes | wordpress |
Is there a way to create a template to display a gallery thumb layout? Or am I stuck with selecting a thumbnail size and rows in the upload image/gallery area and media settings area? | One of the better approaches is to unregister WP's default gallery shortcode function, and add your own customized replacement. WP engineer has a great post about it here . This also will let you fix that funky inline CSS that the default gallery adds to the page. | Gallery Thumbnail Layout Template | wordpress |
I'm trying to push some variables to google analytics and would like to be able to detect if a shortcode has been included on a page at all. Anybody know a smart way going about this? Thank you! Noel | I have sometimes wondered the same thing - whether wp maybe checked on save and kept a register etc I had a quick look at the code, and it seems not. There is however a global <code> $shortcode_tags </code> , and wp has this function <code> function get_shortcode_regex() { global $shortcode_tags; $tagnames = array_keys... | How to detect if a Shortcode is being called on a page? | wordpress |
I want the smilies to be generated in my sidebar (where it shows the recent posts, comments etc.) and not being displayed as text only. I've been searching through the Wordpress Codex, Google and here, but couldn't find any answers. Is this possible at all anyways? How would I do it for recent comments that I display i... | WordPress converts text emoticons to their image equivilents with a function appropriately named <code> convert_smilies </code> . To get smilies to show up, say, in text widgets, you would need to run the widget text through that <code> convert_smilies </code> function. You do this by adding a filter: <code> <?php a... | Display smilies in Sidebar, too? | wordpress |
I'm using <code> <?php wp_tag_cloud( $args ); ?> </code> to create a tag in my sidebar. With the "args" you can style it quite a bit, even the different text size, but it doesn't seem to be possible to apply different colors. What I did is a plain CSS solution which looks somewhat like this: <code> #tagcloud ul .... | Use a stackexchange-url ("filter for the tag cloud") to change the inline size declarations to CSS classes and declare the colors in your style sheet: <code> .tag-cloud-size-8 { color: #009; font-size: .8em; } .tag-cloud-size-10 { color: #900; font-size: 1em; } </code> | Tagcloud: different color for different text size | wordpress |
I'm trying to filter a loop by a custom field value. I've tried all of the suggestions on the site, but it just won't filter. This loop is being used for a custom template of an rss feed. It pulls together the custom post type and only the posts that are "published", but I can't get it to filter by custom field value. ... | How about this: <code> $my_query = new WP_Query(array( 'post_type'=> 'custom_type', 'post_status' => 'publish', 'meta_key' => 'my_custom_field', 'meta_value' => 'custom field value' )); if($my_query->have_posts()): while($my_query->have_posts()):$my_query->the_post(); //All the post stuff here. end... | Filter Loop by Custom Field Value | wordpress |
I have developed my own theme as a variant of Twenty Eleven. I am trying to avoid having <code> aria-required </code> being printed by the comments template. For ease of maintenance I'd rather override the comment template in my own theme than change the one that is currently being called. How do I go about overriding ... | I'm not sure why you would want to remove the <code> aria-required </code> attribute. It is a form attribute in draft at W3 that deals with accessibility for working with applications and handicapped users. Anyway, you can remove it by filtering the <code> comment_form_default_fields </code> and <code> comment_form_fie... | Avoiding calls to theme-compat | wordpress |
I don't have access to my old blog any more. However, I do have all the files (wordpress export and uploads folder). Now... I'm trying to import all that stuff in my new blog and unfortunately I can't upload my media files. There is an option to "import and download" but it tries to download files from my old server (n... | You'll need to open the xml file and manuall do a search and replace for the old URL and replace it with the new URL (It sounds like you're using the import plug-in, if not you'd open the SQL DB File to make the changes). You can use NotePad++ for a simple search and replace. Since the images aren't on your older serve... | How to import media from folder as opposed from old site? | wordpress |
Although I've read several times through the Wordpress Codex , I have difficulties to do what I want. Actually this is for certain parts of my blog, so I guess once I figure out how to do it I can make it work for all of them. For example: If there are no tags, the CSS coding is still shown (background, image etc.) whi... | For the pingbacks <code> ul </code> & <code> h2 </code> you'll have to move it inside your <code> mytheme_comments </code> function, which should be in your themes <code> functions.php </code> file. The tags are a bit easier, you just need to them inside the php: <code> <?php the_tags('<div class="postTags"&g... | Conditional tags help (if none, don't display anything) | wordpress |
I encountered this problem what i thought to be one of the worlds simpliest things, I wanted to add a subtitle to the menu somethin alike this http://img4.imageshack.us/img4/7816/unled10b.png . Then i came to realise that the menu doesn't have its own custom template file, so my plan on loading the page's meta data nam... | related post: http://www.kriesi.at/archives/improve-your-wordpress-navigation-menu-output | Add meta data to the menu | wordpress |
I found this great article ( right here ) about creating and saving custom fields for user profiles. The problem is that it only saves text fields. I can't save checkboxes, radio, or any other field types. Here is the code I am using in the functions.php of my theme: <code> <?php add_action( 'show_user_profile', 'my... | How do you know that the checkbox value is not being saved? I'm guessing that it is saved to the database; however, in your code, you do not have any method of setting the "checked" attribute for the checkbox to "checked". As such, you will not see the boxed checked. You'll need something like the following to achieve ... | Save custom field types with this function...? | wordpress |
I'm working on a theme index.php and it seems that when I use the "template_directory" it is not actually pulling the url path of the file, but instead is just pulling the main domain name. So instead of <code> http://example.com/wp-content/themes/theme_name/images/pic.jpg </code> its pulling the domain url and showing... | To get the exact path of image which is placed in http://example.com/wp-content/themes/theme_name/images/pic.jpg in your theme. All you have to use below code: To show image <code> <img src="<?php bloginfo('template_url'); ?>/images/pic.jpg" /> </code> | Template Tag "template_directory" pulling wrong path | wordpress |
I'm wondering if there's a simple way top stop WordPress automatically hardcoding featured image height and width attributes, other than using regex... As I'm using a flexible grid for my project (who isn't!) this is causing some funky image issues. | You can get featured image URL and add it to your content manually, eg: <code> <?php $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'thumbnail' ); if ($image) : ?> <img src="<?php echo $image[0]; ?>" alt="" /> <?php endif; ?> </code> | Stop wordpress from hardcoding img width and height attributes | wordpress |
I did have a similar problem with this but never managed to find a solution... I have a custom post-type with a number of pages, but what I want to do is grab a particular div from the pages and display them in a Fancybox when I link to them. Here is the HTML: about.php - this page has the fancybox links, so I want the... | Remove the <code> get_header() </code> , <code> get_footer() </code> , and <code> get_sidebar() </code> references from <code> single-team.php </code> . | Open div inside a custom post-type with Fancybox | wordpress |
I couldn't find the solution anywhere else, so I believe is a valid question for this website. I think my problem is divided in two parts. I created a custom taxonomy called "Type" and within it, I have terms (tags) like "cool", "sad", "amazing"..and so on. 1) I want to associate an icon for each one of my terms. 2) I ... | My Media Categories plugin lets you categorize images, and in the latest update I've added to ability to pass a 'category' parameter to the standard gallery shortcode. So perhaps you could use the gallery shortcode to present your images on your front page. My next release will include the ability to filter the taxonom... | How to associate an image with a term taxononmy and publish it on frontpage? | wordpress |
Why is the CSS class called 'xoxo'? What does it mean? | I was curious about this myself one day. Here's a link explaining it. Excerpt from Wikipedia link above: XOXO (eXtensible Open XHTML Outlines) is an XML microformat for outlines built on top of XHTML. Developed by several authors as an attempt to reuse XHTML building blocks instead of inventing unnecessary new XML elem... | Why does the TwentyTen Theme sidebar have a class called 'xoxo'? | wordpress |
We know you can do <code> if ( is_singular( 'my-cpt' ) ) </code> to test for a specific custom post type, but what about doing one thing if the post is a built-in post type, and another if it is not? Is it enough to just test against <code> if ( is_singular() && ! is_singular( 'post' ) ) </code> ? Or are there ... | I don't know of a conditional tag, but here's how you would list the built-in types: <code> echo implode(',', get_post_types( array('_builtin' => true ) ) ); </code> Output: <code> post,page,attachment,revision,nav_menu_item </code> Maybe better: <code> // 1 result if it exists and is builtin, 0 otherwise get_post_t... | Is there a conditional tag to determine whether the post is _any_ custom post type? | wordpress |
I'd like to query only pages with a certain page template with WP_Query or a function that would return the post object, but I can't find any information about that on the officiel codex. | Try this... Assuming the template name is 'my_template.php', <code> $query = new WP_Query( array( 'meta_key' => '_wp_page_template', 'meta_value' => 'my_template.php' ) ); //Down goes the loop... </code> You can also use get_posts , or modify query posts to get the job done. Both these functions use the same para... | Page template query with WP_Query | wordpress |
How do I set my custom loop to only show top-level posts? I have a hierarchical custom post type and the archive page shows both the parent and child posts. | This solution is based on some code by Justin Tadlock . pre_get_posts is called before WordPress gets the posts of the main loop. Basically, you test to see if the page is the archive of the post type and make sure post_parent hasn't been set. Then you set post_parent to 0, which is the default parent of top level post... | How to display only top level posts in loop via WP_Query? | wordpress |
I know they do not allow plugins on wordpress.com and hence no ads. I know I can put adds on own wordpress site hosted on my own domain. But I really like wordpress.com and the ease you can create blogs there. Is there any decent way that I can put my ads on google? Weren't they allowed the ads before? Or would anyone ... | No, you cannot, unless you have 25,000 pageviews/month, as stated here! http://en.support.wordpress.com/advertising/ Go with hosted or self-hosted solution of Wordpress instead. | Is there any way I can put google ads on wordpress.com? | wordpress |
Standard WordPress post types have "Post Tags" which can be used to "tag" posts with similar content, makes those similar posts easily accessible just by opening that particular tag page and receiving the list of all posts. I need exactly the same thing with my custom post types: ability to tag the post with multiple t... | I actually managed to figure it out and did it just beside the code of my custom post type. Like Fred suggested, I need to add a taxonomy to my custom post type called "tag". And this is the way to do it: <code> register_taxonomy ( 'myposttype-tag', array('myposttype'), array ( 'hierarchical' => false, 'labels' =>... | Adding post tags to custom post types | wordpress |
I want to insert the category or page ID of the current page into my HTML so that I can use CSS to style each page based on what it is. For example, if had a category called "News" and it's ID was 5, my source code would end up having in it. Then I could use CSS to style #category-id-5 to suit my needs. How would I acc... | <code> get_queried_object() </code> has a property with that ID. But you don't really need it, because the <code> <body> </code> tag should have a class with the current category / page ID... | How do I get category and page ID's? | wordpress |
By default, media uploaded through the Wordpress dashboard goes into a folder determined by the current date. For example: /wp-content/uploads/2011/09/. Once the media is uploaded I'm not seeing any options in Wordpress to change the location of my file to something else. Can I tell Wordpress to place my media in a sep... | Go to <code> Dashboard -> Settings -> Media </code> Enter the desired location in Store uploads in this folder Uncheck Organize my uploads into month- and year-based folders This will specify the global upload location. To specify a per-file upload location, you'll need to use a Plugin, such as WP Easy Uploader (... | Can I upload media to a specific folder? | wordpress |
I am working on a plugin with 6 submenu pages. I want 5 of them to be accessible by Administrators only and 1 of them to be accessible by Subscribers only. Both user roles will have different features available on their respective pages. Is it possible to do that? If yes, how? If no, what are the alternatives? Thanks f... | Is this right: First 5 pages - Administrators ONLY, NO subscribers Sixth page - Subscriber ONLY, NO Administrator ? If this is correct than you only have to add the capability type as 'administrator' when creating the first 5, and 'subscriber' for creating the sixth. That should work. Or add a new capability for admin,... | How to restrict plugin's sub-menu pages to admin/subscribers? | wordpress |
I would like to add a custom bulk action to a custom post type. I came across the filter <code> bulk_actions-screenid </code> , which according to its documentation, would do exactly as I wish . However, after about two hours of debugging I found the following comment <code> // This filter can currently only be used to... | The <code> bulk_actions-* </code> filter doesn't allow you to add custom bulk actions precisely because it's tricky to then add a handler for a that action. Updated the Codex. I would suggest using the <code> load-* </code> action instead of <code> admin_init </code> . Note that you have to do all the security checks l... | Custom bulk_action | wordpress |
I want to create a loop that excludes a category and only displays a certain number of posts per page. I have tried both have_posts and query_posts to do this, but I'm a bit stuck on the most effective method. What would you use to do this? | Just use a custom query like this: <code> $exclude_cats = '2,52,3'; $posts_per_page = '4'; $loop = new WP_Query("category__not_in=$exclude_cats&posts_per_page=$posts_per_page"); if($loop->have_posts()): while($loop->have_posts()): $loop->the_post(); //Do stuff here the_content(), the_title() etc... endwhil... | Most Effective Method? Exclude Category and Number of Posts Per Page | wordpress |
As I'm using the jQuery Tool "Scrollable" for my Related Posts section (see example here ), I was wondering how I can implement an offset so that in the first loop it'll show the first 4 posts, then the next 4 related posts etc. I'm thinking about creating 3 loops like that right now, displaying the latest 12 related p... | doing 3 separate queries is unnecessary and inefficient, do one query for all 12 posts and output your container markup every fourth post. <code> $args = array( 'tag__in' => $tag_ids, 'post__not_in' => array($post->ID), 'posts_per_page'=> 12 ); $my_query = new WP_Query( $args ); if( $my_query->have_posts... | Loop Offset for tag based "Related Posts" | wordpress |
Does WordPress have any built-in pagination functions to show the page numbers instead of previous and next page links? If not, how can I add that? Thanks | It depends on which pagination you're talking about: Archive Index pagination Single-Post pagination Comments pagination In all three cases, the answer is yes , but the implementation is different. Archive Index Pagination WordPress provides a function, <code> paginate_links() </code> , for post-archive pagination link... | How to add pagination with page numbers rather than next/previous links? | wordpress |
I've been trying to add category, tag, or custom taxonomy support to images (or all media, though I'm only concerned with Images). I've got it part-way figured out with: <code> add_action('init', 'create_image_taxonomies'); function create_image_taxonomies() { $labels = array( 'name' => 'Media Category' ); $args = a... | Here's how I recently added a custom taxonomy to the media library as a sortable column: <code> // Add a new column add_filter('manage_media_columns', 'add_topic_column'); function add_topic_column($posts_columns) { $posts_columns['att_topic'] = _x('Topic', 'column name'); return $posts_columns; } // Register the colum... | Adding Category/Tag/Taxonomy Support to Images/Media | wordpress |
Been looking around and can't find this. Is it possible to remove, let's say, the title area on post format: "quote"? Or the editor on post format: "image"? I noticed this page in the Codex: http://codex.wordpress.org/Function_Reference/remove_meta_box Seems you could pull it off if you created a custom post type for i... | You're talking about the format setting which was introduced in WP 3.1 for the <code> posts </code> post type? No, I don't think this is possible. To remove the title-, editor- or any other metabox, you have to remove the <code> support </code> for this feature from the current <code> post type </code> . (e.g. remove t... | Remove Title, Editor and Meta Box Support Based on Post Formats | wordpress |
I have added a new custom post type named: website_bookmarks I plan on using it as my bookmarks manager (going to export all my bookmarks from Google Chrome into my custom post type) for the following reasons Can search bookmarks easily Can add tags (php, web design, etc...) Can add descriptions to explain the bookmark... | did you try <code> if (!isset($post_type)) </code> or <code> if(empty($post_type)) </code> ?? For example I would try this: <code> function mySearchFilter($query) { $post_type = $_GET['post_type']; if ($query->is_search) { if (!empty($post_type)) { $query->set('post_type', $post_type); } } return $query; } add_fi... | Can NOT search my custom post type? | wordpress |
I'm developing an article site where an user can register and post the articles and the URL would be like http://domain.com/articles/category-name/article-name The site will also be having a blog under http://domain.com/blog/ And the blog section will only be accessed by site owners and not by any registered users. I w... | Generally choosing separate WP installations means that your websites won't have anything in common. Choosing Multisite installation enables you some sort of centralization. Your blogs usually are separate (eg. different domains / themes), but they may share something. According to your description you might want consi... | Should I go for Multisite or separate WP Installation? | wordpress |
I have followed this tutorial and this one to add a custom column to a custom post type edit screen, showing the post parent of each post. My question: How can I make the post parent clickable just like in the Category column of the standard manage posts screen so that when I click on a specific post parent, only posts... | The problem is that 'post_parent' is not a public query var, i.e. you can use it only from code. To be able to use it from the URL, you just need to add these lines of code: <code> function make_post_parent_public_qv() { if ( is_admin() ) $GLOBALS['wp']->add_query_var( 'post_parent' ); } add_action( 'init', 'make_po... | How can I filter posts by post_parent in the admin? | wordpress |
I am newbie to wordpress plugin and this is my first plugin which I am doing now. I want that when the plugin will be activate it will make some predefined fields in the database and also the same fields in the form page. So how to do that. Any help will be highly appriciable. | Read the WordPress codex, specifically http://codex.wordpress.org/Plugin_API and if you are looking to create tables read http://codex.wordpress.org/Creating_Tables_with_Plugins . Make sure you remove them if the plugin is uninstalled. | Creating fields in the database | wordpress |
I am using the theme Feed Engine for a question and answers site. I am having a problem that it is not displaying the captha(see here ). I would be very thankful if someone could help me out. Thanks in advance. EDIT: Here is the file <code> CaptchaSecurityImages.php </code> which gives error on line <code> 34 </code> <... | I think you have problem in font files path. Just check this link . Please fix your font path. You can check this page for reference. Read the comment section of this page. Thanks | Capcha not getting displayed | wordpress |
My current theme has a portfolio section where you can have an array items based on what category they are in. My problem is that I have several pages that I want to be in the portfolio section but can't add them there because you can't assign categories to individual pages only posts. Is there any method or plugin aro... | Category is a taxonomy that applies to Posts. Pages are not Posts. Pages are Pages. If you need your content to use the Category taxonomy, you have a couple options: Use Posts, rather than Pages, for that content. Register the Category taxonomy for static Pages, e.g. by placing the following in <code> functions.php </c... | Set a category for a page | wordpress |
I've got javascript (a) and jQuery script (b). I need (b) to run after (a) has finished running. I need them to run sequentially. How do I do that? In wp_enqueue_script, I've made (b) dependent on (a), but it appears that (b) runs before (a) has finished processing. I'm trying to use the_maps_bounds, a variable I've pu... | To accomplish this, wrap wp_enqueue_script in a function and run it through the action hook wp_enqueue_scripts while using the 'priority' parameter available in add_action to set the load order. <code> function these_go_first() { wp_enqueue_script('first_script', '[path to file]/first.js', array('jquery'), '1.0' ); } f... | How to Run a jQuery Script after a Javascript Script has Finished in WordPress | wordpress |
I've created a custom post type, and i want to display and allow comments. I have this in function.php : <code> // Add Custom Post Types add_action( 'init', 'thm_post_types' ); // Add Custom Post Types Function require_once ( THEME_INCLUDES . 'theme-post-types.php' ); require_once ( THEME_INCLUDES . 'theme-comments.php... | Have you tried adding comment support to your custom post type, via <code> add_post_type_support() </code> ? e.g. <code> <?php add_post_type_support( 'product', array( 'comments' ) ); ?> </code> | Comments not showing in custom post type - Wordpress | wordpress |
I'd like to integrate <code> get_post_meta </code> into the <code> wp_list_pages </code> mix so that any top-level parent list items get replaced with images ONLY when a key exists in the post's custom fields section. I can't do it with the Featured Image b/c that's already being used for another purpose inside the pos... | I went to the #wordpress irc channel and was given the answer by Marko Heijnen . He grabbed the Walker Code from /wp-includes/post-template.php and added a few lines to it. <code> /** * Extend the default page walker class to append class names for pages that * are parents. * @uses Walker_Page * * stackexchange-url * *... | How to use custom fields to replace top-level parent title with an image using wp_list_pages? | wordpress |
I have 3 custom post types, and they each have a taxonomy labelled <code> location </code> , with some term names shared between them. The problem is, if I update a term name in any of the 3 custom post types, it updates the other 2 also, if the same term name is found. This also happens for the slug of the term Each i... | Ok found a ticket on the trac. It's a bug and has been around for quite some time (~4 years). Hopefully it's fixed soon http://core.trac.wordpress.org/ticket/5809 | Taxonomy terms with the same name are updated between separate custom post types | wordpress |
I'm working on a site for a small business academy. We're trying to create an application for potential students to fill out to apply for the school. The form needs to be able to have multiple long-form questions, (paginated would be nice for each), and before the application is submitted, the students would have to pa... | Yeah, go with Gravity Forms, it has several options for payment, supports paginated forms and there are even more third party extensions to add payment gateways. Check out my review for some more tips about it. | Application form plugin with payment gateway | wordpress |
I keep seeing this pattern, and wonder what it's for, how WP uses it internally: <code> if ( empty($post) ) { if ( isset($GLOBALS['post']) ) $_post = & $GLOBALS['post']; else return $null; } elseif ( is_object($post) && empty($post->filter) ) { _get_post_ancestors($post); $_post = sanitize_post($post, 'r... | The $post-> filter contains the context under which the contents of the post have been filtered. Context could be something like "display" indicating the post is meant to be displayed on the page. This is done by the sanitization functions, to indicate under what context the post data was sanitized. Different contexts ... | What's $object-> filter for? | wordpress |
Hey so I am trying to determine how Wordpress remembers which editor is being used for a particular post (HTML or Visual Editor (tinyMCE)). When you write a post, and then come back, it goes to the last used editor. I am assuming its a cookie of some sort (because I couldn't find any info in the database), but does any... | wp-settings cookie screenshot its stored in the cookie wp-settings-USERID, replace USERID with the id of the logged in user. the two values are editor=tinymce or editor=html | How does Wordpress remember which editor is being used? | wordpress |
I am trying to figure out how to modify the HTML editor in wordpress; on the image below you can see a screenshot of the editor and the buttons on the top. Is it possible to add new buttons? I would like to add a button that will insert "" tags and some custom short-code tags as well. I know it's not impossible, but do... | Download and install HTML Editor Reloaded Plugin and go to setting pages and you can add your own new buttons. http://wordpress.org/extend/plugins/html-editor-reloaded/ | Add quicktag buttons to the HTML editor | wordpress |
I want an email to be sent to a specific list of email addresses if/when there have been no posts on the blog within the past 1 week. Any ideas on how I could do this? | You'll need to set up a cron job that checks once a day to see if the latest post is more than seven days old. So, some where in a plugin file. Schedule a new event. Then hook into that event. Grab the post date, turn it into a unix time stamp, and compare that with the current time. <code> <?php register_activation... | Generate Email if No Posts Within Time Period | wordpress |
How do I link to the image editor's Edit Image function from the front end? I know that I can open the lightbox with a simple link, such as <code> <a href="wp-admin/media-upload.php?post_id=719&amp;type=image" id="content-add_image" class="thickbox add_image" title="Add an Image">Upload photos</a> </cod... | You may add the following scripts: <code> wp_enqueue_script( 'wp-ajax-response' ); wp_enqueue_script('image-edit'); wp_enqueue_style('imgareaselect'); </code> Maybe this already helps? I think the html in the front-end should be similar to the html in <code> /wp-admin/media.php?attachment_id=...&action=edit </code> | How to link to the image editor's Edit Image function? | wordpress |
I have a page that lists all sub pages of the current page. Each page has been assigned an order number in the wordpress editor but they aren't ordering for some reason. I'm set up like this: Products -page1 -page2 -page3 -page4 -page5 my query_posts looks like this: <code> query_posts('post_type=page&order=ASC&... | I was going to suggest using <code> &orderby=menu_order </code> , but you already pointed it out in your comment. :) p.s. you can answer your own question, I think. Since you found the answer to your question, just post your own answer. I think it's kosher to accept your own answer? | Wordpress query_posts and orderby page order | wordpress |
The obvious way is to iterate through the resulting array of IDs, get_post for each and test against <code> post_status == 'publish' </code> . But I wonder whether this could cause memory issues since <code> get_post </code> will attempt by default to cache each result? Short of a custom SQL join, are there any surpris... | You can add <code> 'post_status' => 'publish' </code> in your query to retrieve only objects with status publish , this will work for <code> get_posts </code> , <code> query_posts </code> or <code> $wp_query </code> and to include also custom taxonomies you can use <code> tax_query </code> in your args list | Elegant way to include only published posts with get_objects_in_term()? | wordpress |
I'm just trying to find a way to narrow my current search bar so that it only searches within my 'events' custom post-type. I do not want the search to index any other post type, only 'events'. Here's the search bar: <code> <form id="searchform" action="http://localhost:8888/ltc" method="get"> <input class="in... | To search for a custom post type , you can add to the query <code> &post_type=events </code> , to achieve this just edit your form like this <code> <form id="searchform" action="http://localhost:8888/ltc" method="get"> <input class="inlineSearch" type="text" name="s" value="Enter a keyword" onblur="if (thi... | Simple way to search custom-post types only | wordpress |
So I have a WP_Query like so: <code> $homepage = new WP_Query( 'posts_per_page=1&cat=-5' ); </code> and in my while loop, I have a call to <code> next_post_link() </code> and <code> previous_post_link() </code> , which are both showing posts from the excluded category. Here is what my code looks like next: <code> &... | You'll have to exclude the category in your <code> next_post_link </code> and <code> previous_post_link </code> calls too, as it's using the posts data, not your specific queries data, so, this should fix it: <code> while ( $homepage->have_posts() ) : $homepage->the_post(); next_post_link( '&laquo; %link', '%... | Ignoring a category in WP_Query still shows the links in next_post_link()? | wordpress |
I'm building a WordPress options panel. In my options panel I added the following, this creates a Yes/No dropdown menu asking whether or not the user wants to display breacrumbs - I want to be able to hide (or simply not call) the breadcrumbs when a user selects no : <code> array( "name" => "Display breadcrumbs on p... | Why not just check the options before calling <code> dimox_breadcrumbs() </code> like so: <code> <?php // Check if the user wants breadcrumbs, default to "Yes" if no option set if(strcmp(get_option("to_breadcrumbs", "Yes"), "Yes") == 0){ if (function_exists('dimox_breadcrumbs')) { dimox_breadcrumbs(); } } ?> </co... | Function to add DIV Class? | wordpress |
Ok so at the moment I have a page which displays a list of categories within my Taxonomy (event-themes), here's the code: <code> <div id="themeSearch"> <h1 class="mainSectionHeader">By Theme</h1> <ul id="themeSelector" class="jcarousel jcarousel-skin-tango"> <?php //list custom portfolio cate... | This should work: <code> foreach ($tax_terms as $tax_term) { echo '<a href="'.get_term_link($tax_term).'">'.$tax_term->name.'</a>'; } </code> Simplified a bit from your version for readability. | Creating links to a page displaying posts from a particular category | wordpress |
I'm using this function to add a custom end point to the WordPress urls <code> add_rewrite_endpoint('print', EP_ALL); </code> When the plug-in gets deactivated, I run this function <code> flush_rewrite_rules(); </code> This flush the rewrite rules, and disable the 'print' end point. Fine. But I'm thinking of other plug... | What <code> flush_rewrite_rules(); </code> does is call <code> $wp_rewrite->flush_rules(); </code> (Also called when updating permalinks). All plugins rewrite rules are regenerated then, so you dont need to worry about other plugins rules being "missing". Also is not a good idea to call this function ( <code> flush_... | Flushing rewrite rules | wordpress |
I'm including a php file in single.php, in the loop. Is it possible to use WP variables such as the_title(), the_date(), etc in the included php file? | Get the title into a variable, and use the variable in the included PHP instead: <code> $title = get_the_title(); include "yourfile.php"; </code> yourfile.php: <code> <?php echo $title; ?> </code> | Using WP functions such as the_title() in an included php file | wordpress |
I am working on a theme which contains a custom post type with custom fields. Everything is working perfectly except the when a new custom post is added, the custom fields for the first custom post and first one only are wiped. <code> function save_details(){ global $post; update_post_meta($post->ID, "testimonyname"... | the problem was worse than I thought. Here is the solution: stackexchange-url ("Add New Post (Custom Post Type) Deletes 1 Post's Custom Meta Data") | First Custom Post Custom Fields Empty After New Custom Post | wordpress |
I have a wp multisite installation with multiple blogs that are totally separated websites. I use a plugin for domain mapping. Right now I am configuring everything and I wanted to remove the /blog slug from the main blog, I did it by editing the settings as "network admin". I used /%POSTNAME%/ and / for category and t... | You can't have / as category and tags base, at least not without using a plugin like this one: http://wordpress.org/extend/plugins/fv-top-level-cats/ Doing it for both tags and categories seems almost impossible to me though. | Categories show 404 error on multisite installation | wordpress |
Sorry to ask such a basic question, I've looked at other questions and not found an answer. I've customized some public pages with their own header-public.php, and I'm doing a basic login check for all other pages right at the beginning of the page (line 1 in header.php). The intent is to redirect unlogged users to a r... | <code> wp_redirect </code> send a header, so echoing anything before it will make the redirect fail. So, in this case you could remove <code> echo network_home_url( '/receptionist' ); </code> and if there isnt any output being sent it will work just fine. Update: In both cases the issue is that you do an infinite redir... | wp_redirect not working in header, exit is breaking page | wordpress |
I'm trying to take away the option to have sharing options on 'pages' (but leave on posts). So I have a function to make sure the sharing option is always no on pages <code> function page_disable_share($post_id) { if ( 'page' != get_post_type() ) return; update_post_meta($post_id, "sharing_disabled", 1); } add_action('... | Use the <code> add_meta_boxes </code> action with a very low priority, so: <code> function page_remove_share() { remove_meta_box( 'sharing_meta' , 'page' , 'advanced' ); } add_action( 'add_meta_boxes', 'page_remove_share', 99 ); </code> I think that should work. | Remove ShareDaddy meta box from Pages only | wordpress |
I'm trying to minimize my code and have put together this little snippet, it doesn't seem to work however. What am I missing? <code> query_posts( 'year=2011' ); if ( have_posts() ); while ( have_posts() ); echo 'test'; endwhile; wp_reset_query(); endif; </code> | Because you're using semicolons when you should be using colons after the <code> if </code> and the <code> while </code> :) <code> query_posts( 'year=2011' ); if ( have_posts() ): while ( have_posts() ): the_post(); the_title(); endwhile; wp_reset_query(); endif; </code> That works just fine. | Alternative loop syntax error | wordpress |
Where is the reset password key stored in the wordpress DB? Is this the same as the user_activation_key? WP version 3.2.1 | From line 213 of wp-login.php: <code> $wpdb->update($wpdb->users, array('user_activation_key' => $key), array('user_login' => $user_login)); </code> So yes, the key is the <code> user_activation_key </code> . Don't know what you need to know that for but if you look in that file you'll see there are several... | Where is the reset password key stored/generated? | wordpress |
Within my multisite installation I can get the registered and last updated time strings for a sub blog through get_blog_details and the blog ID: <code> echo get_blog_details($blog_ID)->registered </code> Ok, how do I format the resulting time string: <code> 2011-09-28 00:20:34 </code> Thanks | <code> $time = get_blog_details($blog_ID)->registered; $unix_time = strtotime($time); $my_time_format = date('Y-m-d H:i:s', $time); // eg. 2011-09-28 00:20:34 $diff_format = human_time_diff($time); // eg. 2 days </code> See date() and replace <code> Y-m-d H:i:s </code> with the format you want | WPMU function get_blog_details, last_updated/registered and formatting time and date string | wordpress |
Is it possible to create a special wp query that looks to see how many posts exist in a specific taxonomy, or taxonomy term, and executes a particular loop depending on the volume of posts? My idea behind this is - Id like to be able to show particular CPT content in a different styled format depending on how many of t... | Just check the total number of posts found: <code> if($your_query->found_posts > 20) ... </code> and decide how do you want your mark-up to be. If want to see how many products are associated with a certain product_category term, use get_term() and check out the 'count' property | Query for specific taxonomy that executes a particular loop depending on volume of posts? | wordpress |
I want to make edits to the following so that I can display the author and date but without those being links to searches 'by date' and 'by author'. The site I'm building will only have one author and I want to lock down the searches users can do. Code as follows: <code> <?php printf( __( '<span class="sep">Po... | The % signs are arguments in the string to be formatted. The s represents a string type argument must be passed. I've notated which arguments are connected to which strings being passed in. <code> get_permalink() - %1 string type get_the_date( 'c' ) - %2 string type get_the_date() - %3 string type get_author_posts_url(... | Toolbox theme using printif statement - help needed understanding code block | wordpress |
The one problem that is always finds me again is that I cant find particular pages. Lets say I created a product from the admin panel. I have a link to the page, but now I need to edit the look of that page. Where I can find this page physicaly? | WordPress uses a template system- content is stored in a database and gets inserted into a template when a page is served, so pages and products don't exist as separate, physical things. To edit the templates Wp E-Commerce uses, go to Settings > Store and click on the presentation tab. There will be an advanced Theme S... | How to edit products page of wp ecommerce plugin? | wordpress |
I've been using WP for years, but this is my first time with taxonomies, so I need a little bit of help. Like in the question stackexchange-url ("How to show a hierarchical terms list?") I have a taxonomy called <code> places </code> , which contains a hierarchical list of places (first level for countries, second leve... | <code> wp_get_object_terms </code> will give you the term assigned to the post, you could then use <code> get_ancestors </code> to get an array of the parent's IDs, then <code> get_term_by </code> ID to get the names and slugs. | Taxonomies: display hierarchical parent list | wordpress |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.