question stringlengths 0 34.8k | answer stringlengths 0 28.3k | title stringlengths 7 150 | forum_tag stringclasses 12
values |
|---|---|---|---|
I have a landing page that, among other things, features an excerpt from the most recent post with a "Continue Reading" link that should take the reader to the most recent post. In my search, I've found a lot of guides on how to link to the most recent post within a specified category, but not much on the most recent p... | This code uses snippet from @Milo to suit your requirement. Replace the code you've provided in question with this - <code> <li> <h2><a href="http://growingedgecoaching.com/blog">Growing Edge Blog</a></h2> <?php $latest = new WP_Query( array( 'posts_per_page' => 1 ) ); while( $latest... | link to single most recent post, regardless of category | wordpress |
I have looked through the posts here that involve this same error, without any luck. I have a Custom Post Type (Staff) and a custom taxonomy for it. Making Staff posts and assigning terms is working fine, but I'd like to list all of the Staff in groups based on the taxonomy terms. But the terms do not come through . Th... | In your Template File, it looks like <code> get_terms </code> function is getting passed null data since the <code> $taxonomies </code> object is just an array of strings, not an array of objects. In other words, try changing: <code> $terms = get_terms( $taxonomy->name ); </code> to <code> $terms = get_terms( $taxon... | Invalid Taxonomy in template | wordpress |
Is there a way to enqueue my <code> style.css </code> (and other stylesheets) AFTER a certain plugin enqueues its styles? Specifically, I want my <code> style.css </code> to overwrite cforms's styles, but when I change the priority of the add_action, it doesn't do anything. Here's what I have: <code> function rm_theme_... | Note that cForms is hooking into <code> wp_head </code> , and you're attempting to hook into <code> wp_enqueue_scripts </code> . The <code> wp_enqueue_scripts </code> hook is fired inside the <code> wp_head </code> hook (at priority <code> 0 </code> , IIRC). So, your stylesheet is being enqueued at <code> wp_head </cod... | Enqueue styles after a plugin | wordpress |
Problem I have this code in functions.php but it does not output the total number of members (something is wrong with it it breaks the site) in my "Right Now" dashboard. Is there a way to fix it? <code> function dashboard_wps_user_count() { global $wpdb; $users = $wpdb->get_var("SELECT COUNT(ID) FROM $wpdb->users... | So here is the small snippet to show total number of users and all roles with user count. This code should go in the themes <code> functions.php </code> file. The code uses <code> count_user </code> function to fetch the array and show it up on Right Now dashboard screen. <code> function wpse_60487_custom_right_now() {... | Add number of members to “Right Now” dashboard widget | wordpress |
I have to make the bidding site like odesk, freelancer type. Is there any helpful plugin for job, contractor, user, project and payment management in wordpress as these are the main tasks of this project? Secondly, building it in wordpress will be good or in a custom way? | It's not a plugin but a commercial theme, but you might want to check it out. http://sitemile.com/products/wordpress-project-freelancer-theme/ | Bidding site plugin | wordpress |
By default you cannot access a file inside the theme folder directly from the browser, what changes should I make to make an exception? | By default you cannot access a file inside the theme folder directly from the browser But that's just not true . | How to access .html file that's located in the theme folder from the browser? | wordpress |
I need to have different tag titles for each category of my website. I've tried all in one SEO but it looks like i cannot change it individually. Thanks in advance | Would you mind using the "description" field for tags as the SEO title? If so: <code> add_filter( 'single_term_title', 'wpse_60464_title_from_description' ); function wpse_60464_title_from_description( $title ) { if ( ( $obj = get_queried_object() ) && ! empty( $obj->description ) ) $title = $obj->descrip... | SEO module to change tag title for different listing page | wordpress |
I am using the following simple get attachment code to display all images attached to a certain post but I want to be able to exclude the images uploaded via a couple of custom meta boxes that are also attached to the post. For example, how could I exclude an image uploaded with a meta key of sample_image_1 from this c... | Get all of the attachment IDs from your meta fields, put them in an array, and pass that as <code> exclude </code> parameter of <code> get_posts </code> . | Exclude images uploaded via meta boxes from Wordpress gallery | wordpress |
I'm developing a system where user can buy scratch card number using pre-paid balance. I already created balance system using user meta. Now I need to delivery card number to users upon payment. As payment system is ready, I need an idea which will help me to deliver card number. Card numbers will be stored in database... | Here is an idea how we can sort the post based on custom field value and also I'd given some functions to change/delete custom field values. <code> <?php $args = array( 'post_type' => 'card', // custom post type name - card 'meta_query' => array( 'relation' => 'AND', // return post with meta-field key statu... | Serial Number Delivery System Using WordPress | wordpress |
I have a custom template file I've been workin on. I have this code performing a loop after it queries posts from a certain category. This works and I have each post configured with styled divs, but for some reason, on the side of the page, I have strange numbers being displayed. I don't understand where they are comin... | change <code> the_ID() </code> to <code> get_the_ID() </code> . calling <code> the_ID() </code> prints the post's ID, while <code> get_the_ID() </code> simply returns it and allows you to use it further on. reference : get_the_ID() | using query_posts to pull posts out of a category in a while loop. Getting odd echo | wordpress |
on the root page of a WordPress site we have a custom page template, that also handles some forms and dynamically changes part of the content. Something like this: <code> <form action="" method="post"> ... <input type="hidden" name="action" id="action" value="do_this" /> </form> </code> and then in th... | a colleague fixed it using parse_request. similar to this one: http://willnorris.com/2009/06/wordpress-plugin-pet-peeve-2-direct-calls-to-plugin-files | how to create several url aliases for a page | wordpress |
I´d like to do something like this: Pages: 1. Sport 2. Business 3. Normal Custom Category "Car-Types": 1. Audi 2. BMW 3. VW My custom post type will called "Cars" I´d like to show the cars by using a custom category like "Car-Type". How can I filter the content from the custom categories, too and show it? E. G.: On Pag... | <code> <?php $args = array( 'post_type' => 'cars' ); // How can I add a category-filter to this? $args = array( 'tax_query' => array( array( 'taxonomy' => 'Car-Types', 'field' => 'slug', 'terms' => 'Audi' ) ) ); $loop = new WP_Query( $args ); while ( $loop->have_posts() ) : $loop->the_post(); ec... | Custom post types with categories in template | wordpress |
i've been trying to get the attachment URL on single.php, so far this code gets the DIRECT LINK to the image; <code> <?php if ( $attachments = get_children( array( 'post_type' => 'attachment', 'post_mime_type'=>'image', 'numberposts' => 1, 'post_status' => null, 'post_parent' => $post->ID ))); fore... | The <code> the_attachment_link </code> returns html link so use this code <code> <?php if ( $attachments = get_children( array( 'post_type' => 'attachment', 'post_mime_type'=>'image', 'numberposts' => 1, 'post_status' => null, 'post_parent' => $post->ID ))); foreach ($attachments as $attachment) { ... | Get the attachment URL on single.php | wordpress |
I'm looking for a method, or plugin, that will allow me to do the following: User can signup to a 'notifications' email list When a new post is published on the site, users on this list are automatically emailed a notification This is for site visitors as opposed to administrators or registered users. Any suggestions m... | I haven't used it yet, but you can accomplish this with Jetpack , which is made (at least partially) by the founders of Wordpress. The advantage is that it uses the Wordpress.com servers to handle the outgoing mail. This is a big plus because shared servers have throttling limits that only allow you to send a certain a... | Send email when a new post is published | wordpress |
Im using a theme which has my thumbnais set to 150x150px. But after installing plugin (just too check it out) I noticed it displays them correctly, but the default thumbnails are zoomed in. Can anybody give me a clue on where I should be looking? This is the css for the thumbs: <code> #content .featured_box { width: 15... | Isn't it because you're using <code> $crop </code> as <code> true </code> , as the 4th parameter for the <code> add_image_size() </code> function? This will crop the image and does not actually resize the image. | Thumbnails appear to be zoomed | wordpress |
I'm having trouble trying to build a page that let's someone download a .csv file containing data which is set in a variable from the frontend. My code is below, but the only thing that is happening is that the data is being shown in the page, but there is no prompt to download the .csv file. Can anyone see what the pr... | Put all the code that handles the output of the CSV before your <code> get_header() </code> call, then <code> exit </code> : <code> <?php /** * CSV page template * */ if($_SERVER['REQUEST_METHOD'] == "POST") { $fileName = date("d-m-y") . '-bv-directory.csv'; $content = ""; // content added below // Title of the CSV ... | Export csv and force download in template page | wordpress |
Using a get_field('sampleImage'), how would I go about in order to get the image's width and height using the ACF plug-in? I need to be able to print out the img tag with width and height attributes because of a script. | You can get the ID for the attachment with <code> $attachment_id = get_field('field_name'); </code> . When you have the ID you can use <code> wp_get_attachment_metadata() </code> to get the info associated with the image in an array. The images width and height are stored in cells named <code> width </code> and <code> ... | How do I retrieve an image's width and height using Advanced Custom Fields? | wordpress |
I've got a copy of WordPress running that has recently been moved off shared hosting and onto a VPS that I control. While a testing copy of the same site runs correctly on another vhost on the same instance, on the same IP address, after the time when I moved the public site across, the comments form began to redirect ... | Check your .htaccess for possible redirects to the old ip address. i'm filling up the response with text because, honestly there's nothing much to say ;) reference .htaccess | What is causing wp-comments-post.php to redirect to the browser's IP address? | wordpress |
I have a function on my theme ("dancefloor" by "Gorilla Themes") that allows me to make a post in a section in my dashboard called Events (Custom post Type) . If you schedule the date to anytime in the future it will show up in the Events widget or on the Events Page. That all work fine and Dandy. But when you click on... | Opps I take that back ... you must be changing stuff at the same time as i was writing this .. so this answer may not be any help at first it seemed the URL's were wrong the title url is linking to <code> events </code> the read more is linking to <code> event </code> eg .. http://www.gregtaylordesignstudio.com/absinth... | 404 Error for Custom Post type | wordpress |
I am using custom shortcode to show some message at the end of the post. I am finding it hard to do so because it shows up at the top of the post. Here is my code. I am placing the shortcode at the end of the post but the message appears at the top of the post. What should I do to fix this? <code> function hello_kitty(... | Shortcodes are supposed to return your html, not echo it. Make sure you check the documentation on the Shortcodes API http://codex.wordpress.org/Shortcode_API | Shortcode Not displayed at the Right Place | wordpress |
How does one get a custom post by id? FYI: I am passing a particular post id through a form and it's performing an ajax call. I'd like to retrieve just one post and grab the title: <code> <?php // E.g. $loc = 700 $args = array('post_id'=>$loc, 'post_type'=>'seminars', 'limit'=> '1'); $loop = new WP_Query($a... | <code> 'post_id' </code> is not a valid page/post parameter for <code> WP_Query() </code> . Try using <code> p </code> or <code> post__in </code> instead: <code> array( 'p' => 700 ) </code> or <code> array( 'post__in' => array( 700 ) ) </code> | wp_query a single custom post type? | wordpress |
Is there any plugin that allows me to customize my blog homepage to show only most recent post? Problem is that on my home page, it displays too much posts, my blog is here, http://www.nooranibakerally.net/ Thanks | In the admin panel, Go to <code> Settings > Reading </code> and set Blog pages show at most to <code> 1 </code> post. | Display most recent post on homepage? | wordpress |
This is my first time playing with WPMU, I'm trying to move an entire WPMU site into a subdomain of itself for a development environment. The site itself is using subdomains so I'm having a bit of trouble getting it working. Has anyone had this task/problem before? I need to move <code> http://example.com </code> to <c... | Multisite is meant to be either one or the other, and it's not meant to be changed. If I were you, I'd move it to a testing domain rather than a subdomain, since you're going to have to change it back when it's time to move, and I don't know what sort of behaviors you'll see. Tutorial here . Basically, back up your DB,... | WPMU Development Environment | wordpress |
I want a query to be executed IF the following condition is true... but looks like the query is executed anyways. <code> if($post->post_parent = '302'){ // Query goes here } </code> Is this query fine?? I want to executed the query if the parent page of current page is 302. Thanks | The following solution worked <code> $query2= mysql_query("SELECT * FROM wp_posts WHERE ID='$post->ID' AND post_parent=302"); $numrows2 = mysql_num_rows($query2); if($numrows2 != 0) { // query goes here } </code> | Looks like this if condition is not working | wordpress |
I am using <code> is_page </code> in my <code> functions.php </code> file to display some code and I wanted only to display the code in the header if the contact page is being shown. I made a template called contact.php and in the top did the template name: contact. The templates shows just fine but when I went into th... | If the page slug is 'contact' then is_page('contact') should work. You can check out the optional parameters for page in the codex here . Using post ID, e.g. 94 in your example will work regardless of permalink settings. If you want it to display for a specific template you can use is_page_template('contact.php'). | is_page conditional question | wordpress |
I'm trying to create a search bar that will show me titles of posts when the user types into the text field. I'm completely new to this and I really don't know how to go about doing this. What would I do? Here is the text input html element: <code> <input type='text' id='searchField' class='pushLeft tabRight hide' o... | Then "autoSearch.php" has this code: If that's all there is, no wonder you get an error - WP isn't even loaded! Add this to your <code> functions.php </code> <code> isset( $_POST['autoSearch'] ) && add_action( 'after_setup_theme', 'wpse_60353_autosearch' ); function wpse_60353_autosearch() { // The autoSearch.p... | Creating an auto result search bar | wordpress |
Here's my code to generate a two columm blog index page. I want to modify it so that I can use it as an index page for my portfolio custom post type- query_posts('post_type=portfolio'). I know that I need to modify the first quater of the code, but I just don't know what to change. Can you please help me? Code: <code> ... | Modify your code to use the correct query_posts call. Use <code> query_posts('post_type=portfolio&offset=' . $offset); </code> instead of <code> query_posts('offset=' . $offset); </code> Below is your code modified: <code> <?php /* Template Name: 2 Column Blog Template */ get_header(); ?> <section class="c... | How can I modify this blog loop to display custom post type posts? | wordpress |
How it is possible to disable plugin update check and notification for an custom specific plugin in WP Multisite . I think it is also important, the plugin is usable as single activation in each blog of network and also as network wide active plugin. The check is different on an activation on single blog in the network... | I have found a solution for me. Create a plugin, active in network - network wide. This is important on a mu install. If the check only in a plugin, there is active in a blog of a mu install, then was the check only active in this blog and the update check and notice was active in the network. Define the plugins, there... | How to disable plugin update notification for a specific plugin in Multisite | wordpress |
When a super admin adds a network user to a blog via wp-admin/user-new.php where does that confirmation email come from? How do I change? It says incorrectly comes from Wordpress@example.com Thanks | Not sure how to close this post. I used WP better emails plugin http://wordpress.org/extend/plugins/wp-better-emails/ on the subsites and it removed the wordpress email address. (I was only using it on the main site before so it didn't work.) Thanks. | Joining confirmation email | wordpress |
I have the following setup: the front-page is setup as 'static' and it uses a theme page template. On this template / front-page, I need to get the page title, URL and excerpt of the About page. I found this code that does exactly what I need, but I'm wandering if there's a different approach to this, one that would no... | the codex has exacly what you need: <code> get_page_by_title() </code> Example <code> $page = get_page_by_title( 'About' ); $the_excerpt = $page->post_excerpt; </code> or <code> $page = get_page_by_path( 'parent-page/sub-page' ); </code> | get page title, url and excerpt of a page | wordpress |
Hi i was wondering if there is a way that i can display the custom post type title. For example: I have a custom post type entitled "Pretty Little Liars" and it also shows on the homepage, but how do i get the POST TYPE title, not the title of the post to show up like a category. For example: Plublished in: Pretty Litt... | You can write a general template tag for this task. <code> function wpse60306_get_post_type( $echo = true ) { static $post_types, $labels = ''; // Get all post type *names*, that are shown in the admin menu empty( $post_types ) AND $post_types = get_post_types( array( 'show_in_menu' => true, '_builtin' => false, ... | How do i display the post type title? | wordpress |
I would like to add a feature to a page to display a short list of people, like the one seen here . I have done this on other sites by styling lists with css. This time however, it's for a client and I can't trust them to copy and paste a <code> <li> </code> , editing the name, job title and img name without mess... | This can be solved using a Custom Post Type and Custom Fields. Although it can be created manually, a plugin can do it in a breeze. Using Custom Content Type Manager , I just did this in a couple of minutes: Well, I did it fast because I'm used to the plugin. It has a bunch of options that can be overwhelming at first,... | How to Create a Frontend Html-list Editable in the Backend? | wordpress |
Is there any conditional tag which will allow me to display the certain content only if the user is NOT a subscriber? | <code> <?php global $current_user; // Use global get_currentuserinfo(); // Make sure global is set, if not set it. if ( ! user_can( $current_user, "subscriber" ) ) // Check user object has not got subscriber role echo 'User is a not Subscriber'; else echo 'User is a Subscriber'; ?> </code> | Find out if logged in user is not subscriber | wordpress |
The query below is always returning the latest "news" post, not the latest "news" post with the taxonomy "sotm". I have verified the details of my custom taxonomy, name is "postCat" attached to post type "news", and there is a term "sotm" applied to the post I want to display. Can anyone point out what might be wrong? ... | Try something like this: <code> $sotmArticle_query = new WP_Query( array( 'post_type' => 'news', 'tax_query' => array( array( 'taxonomy' => 'postCat', 'field' => 'slug', 'terms' => 'sotm' ) ), 'orderby' => 'date', 'order' => 'DESC', 'posts_per_page' => 1 ) ); if($sotmArticle_query->have_posts... | Help with a query not working with custom taxonomy | wordpress |
I'm having some trouble with a subject that seems to be pretty basic, so I'm starting to feel (a little, only a little) dumb :-) Here's the thing: I want my main feed to include the posts and other content (custom post types) as well. I followed two pointers so far: First I followed this tip at WPmu.org . It works when... | There seemed to be two easy-to-solve problems: The function was being declared twice without checking if it already existed. After solving that issue, i needed to post a "post" post to refresh the feed, but after that custom post types appeared in the feed without further refreshing nor publishing standard posts. | Adding posts of custom type into the main feed | wordpress |
I've had good luck for several years (6 years!) running WordPress with Members Only and Feed Keys . This provided a completely members only blog (no external view at all) as well as private RSS feeds for those members who want it. It looks like a recent update has caused some piece of functionality to stop working, and... | Authenticator, a plugin on github https://github.com/bueltge/Authenticator uses HTTP Auth by default to get the functionality equivalent to Members Only. It also has the ability to create a token to work the same way Feed Keys work. | Members Only site with Feed Keys | wordpress |
-- I've just done a fresh install of Wordpress 3.4 -- I've downloaded and uploaded this new free eCommerce wordpress theme suggested by smashing magazine. { http://www.smashingmagazine.com/2011/10/19/free-e-commerce-wordpress-theme-balita/ } -- And I get this giant error on the homepage: <code> Fatal error: Call to und... | If you followed the install instructions with that theme, one of the steps was to add the WP e-Commerce plugin and activate it. <code> wpsc_cart_item_count </code> is a function of that plugin, so it is likely not currently activated. | Fatal error: Call to undefined function wpsc_cart_item_count() | wordpress |
I am using this code directly from the codex. <code> function echo_first_image ($postID) { $args = array( 'numberposts' => 1, 'order'=> 'ASC', 'post_mime_type' => 'image', 'post_parent' => $postID, 'post_status' => null, 'post_type' => 'attachment' ); $attachments = get_children( $args ); //print_r($a... | If you want display a imagem inserted into your content (link to a image, for instance), you must use a function like this (source): add in functions.php : <code> function catch_that_image() { global $post, $posts; $first_img = ''; ob_start(); ob_end_clean(); $output = preg_match_all('/<img.+src=['"]([^'"]+)['"].*&g... | Get first image in a post | wordpress |
Does Wordpress have something similar to Drupal's drupal_set_message function? I want to notify the user of something and was hoping there was a built in API call to do this. | Here's an idea: use the <code> save_post </code> hook to set a session containing the message you want to show the user and then redirect to the home page. In the home page template, check for the presence of that session and show the message to the user. Something like this: functions.php: <code> add_action( 'save_pos... | Does Wordpress have a built in message function for presenting notifications to users? | wordpress |
I'm attempting to call a Contact Form 7 form using AJAX in a Wordpress theme. I'd ideally like to use the Contact Form 7 shortcode to do this, however it doesn't seem as though do_shortcode is an available function when called using AJAX (it was just echoing out the shortcode itself). I stumbled upon this question: sta... | I dont think it is possible to do this by using the contact form 7 plugin. Because the plugin uses <code> bind('click') </code> on the submit button JS trigger, where it supposed to be <code> live('click') </code> to work on an AJAX loaded form. As an alternative you can use a custom made contact form, or hide the cont... | How do you use do_shortcode via AJAX call? | wordpress |
How can I sort posts by popularity or page views in my template file? I guess I need to count page views first, is there any good plugin to integrate with to sort posts by views or what is the best practice of doing it. | The WP Postviews plugin is one of the most used to record post views . Then you can sort by amount by; <code> <?php if (function_exists('get_most_viewed')): ?> <ul> <?php get_most_viewed(); ?> </ul> <?php endif; ?> </code> Or pass in the variables to the URL: <code> http://example.com/?v_s... | Sort posts by popularity/page views | wordpress |
<code> <?php $current_term = $wp_query->queried_object->name; $current_term_id = $wp_query->queried_object->ID; ?> <hgroup class="section-heading wrapper"> <h1><?php echo $current_term; ?></h1> <h3><?php echo category_description( $current_term_id ); ?></h3> &... | I faced the exact same problem for days and then found this! Use the function <code> $wp_query->get_queried_object_id() </code> . Check this for more details. | $wp_query-> queried_object-> ID throws warning: Undefined property | wordpress |
I have a website with a few custom post types. I have also installed Types plugin so I can use a custom field to upload/display images on the home page of the website. I've found that the code seems to have an issue with the custom post type. If I add the code below the custom post type, the image doesn't appear. If I ... | You have to call <code> wp_reset_postdata() </code> after <code> rg_get_social_pic_of_the_week() </code> . it runs its own query which is polluting the global <code> $post </code> variable that other functions rely on. | Types plugin isn't compatible with my custom post type | wordpress |
I'm coding a plugin. One particular file of this plugin is supposed to pull data from the plugin's custom DB table, and output it with minimal processing as raw XML. The problem is, to get the WPDB class to work when the file was opened directly, I had to add a require to wp-blog-header.php. This worked great BUT it tu... | Include <code> wp-load.php </code> , not <code> wp-blog-header.php </code> . Better yet, hook onto the execution of a standard WordPress request and die early. <code> isset( $_GET['my_conditional_check'] ) && add_action( 'plugins_loaded', 'my_xml_output' ); function my_xml_output() { // do my stuff exit; } </co... | Using WPDB to output raw XML fails because of wp-blog-header.php | wordpress |
I have this manually created page: <code> $user_login = sanitize_text_field( $_GET['user_login'] ); if ( username_exists( $user_login ) || email_exists($user_login) ) { ?> <!--Everything has been validated, proceed ....--> <!DOCTYPE HTML> <html lang="en-US"> <head> <meta charset="UTF-8">... | So if you want to send that the reset password link and you have access to the code base you can use the following snippet and you can modify it further, actually that code is slightly modified version of <code> wp-login.php </code> <code> /** * Handles sending password retrieval email to user. * * @uses $wpdb WordPres... | Sending the reset password link programatically | wordpress |
I wrote my own function to list all taxonomy terms of a certain taxonomy … <code> function wr_list_taxonomy($taxonomy, $orderby, $hierarchical) { $show_count = 0; $pad_counts = 0; $title = ''; $args = array( 'taxonomy' => $taxonomy, 'orderby' => $orderby, 'show_count' => $show_count, 'pad_counts' => $pad_co... | Yes off course. You just need to get the term id and put it on the args. Check <code> wp_list_categories() </code> <code> function wr_list_taxonomy($taxonomy, $orderby, $hierarchical, $cat_id) { $show_count = 0; $pad_counts = 0; $title = ''; $cat_id = 0; $args = array( 'taxonomy' => $taxonomy, 'orderby' => $order... | wp_list_categories() - current-cat class also inside posts? | wordpress |
I like to have login and password recovery managed by my own forms and embed them into my theme. I'm using the well written Jeff Farthing's plugin "Theme My Login" on some of my projects. But I would like to write my own custom functions and avoid the use of a plugin. However I would also like to learn more on the proc... | Having done some research into Wordpress logins in the past, this is one of the few (possibly only?) tuts I could find where the author actually created a new login/register form. http://digwp.com/2010/12/login-register-password-code/ Even so, he still uses the generic Wordpress wp-login.php code. Re-coding the entire ... | Is there any good tutorial to write custom login, registration and password recovery forms? | wordpress |
i'm query multiple taxonomies and have no problem with it but pagination is not working how to solve it, i try alot of suggestion but no success here is my code <code> if ( get_query_var('paged') ) { $paged = get_query_var('paged'); } elseif ( get_query_var('page') ) { $paged = get_query_var('page'); } else { $paged = ... | some how i managed to resolve my problem but another problem poped up, <code> $paged = 1; if ( get_query_var('paged') ) $paged = get_query_var('paged'); if ( get_query_var('page') ) $paged = get_query_var('page'); $args=array( 'paged' => $paged, 'post_type'=>'animes', 'post_status'=>'publish', 'order'=>'ASC... | Query multiple taxonomies with pagination | wordpress |
I love the Cloudfront approach described here: http://www.paessler.com/blog/2011/04/12/network-monitoring-basics/hosting_a_website_through_amazon_cloudfront I wonder if this is possible to do with caching plugins that create static html files? | It depends what you mean, entirely on Cloudfront . Cloudfront is a CDN only. It can't run any server side scripting environments (PHP or MySQL), it therefore isn't possible to host a wordpress site entirely with Cloudfront. You could alternatively use Cloudfront to host your images to improve speed. The closest way to ... | Is it possible to host a WordPress site entirely on Cloudfront? | wordpress |
I hope the title makes sense. But anyway, to clear things up, here is a screen shoot of what I mean: To be honest I really don't see how site admins benefit from this piece of information since they cannot edit the files. I have tried using: <code> div.themedetaildiv p { display:none !important; } </code> but it hides ... | I finally managed to work it out myself, after reading a stackexchange-url ("similar question") over at the Stackoverflow Site : <code> div.themedetaildiv > p:nth-child(n+3) { display:none; } </code> Which means: we go to the theme details and hide all paragraphs after the second one. The first one being the version... | How can we hide the parent's theme url at the child themes details on a multisite? | wordpress |
I created a page template following these instructions: http://codex.wordpress.org/Pages#Creating_Your_Own_Page_Templates I'm having difficulty figuring out how to apply margins, fonts, and font sizes to the new page template. So I'm thinking perhaps there's another way to do it: if I can make the new template so it di... | For custom templates, I tend to use the default <code> page.php </code> , make any changes to the HTML (if need be), and enqueue an overriding stylesheet before <code> get_header() </code> : <code> /** * Template Name: My Page Template */ wp_enqueue_style( 'my-page-template', get_template_directory_uri() . '/css/page-t... | New Template -- copy existing template and change code? | wordpress |
I have posts which are geocoded with latitude and longitude from Google. I basically can enter an address in a post custom field and the latitude and longitude are placed into two separate meta fields. I'd like to create a custom search letting visitors search their zip/postal code and find the nearest locations. I've ... | There's Geo Data Store by our own man, @Brady . It does a perfect job in one of my installations. It uses a custom table, that stores only ID, meta ID, lat and lng information, so your queries stay quick and brief, even when your database starts scaling. It got a 5 star rating from my side. This plugin is meant to be u... | I have geocoded posts with latitude longitude - How to search by radius? | wordpress |
I'm trying to insert the slugs of custom taxonomies as classes in the opening body tag on certain WordPress pages. What I have so far is causing errors. I found a bit of help with the examples here and here , and it works, except that it gives an error on any page that doesn't have a term from the "section" taxonomy. T... | What is the job of <code> $section_name </code> ? Also you must get an return; you if statement kill the default return. It is important, if your if statement fails. maybe this works, but not tested, write from scratch. <code> add_filter( 'body_class', 'section_id_class' ); // add classes to body based on custom taxono... | How to add a body class based on a custom taxonomy term | wordpress |
Can anyone please help me to with the wp_query. I am making a template file/loop to create and archive page of the current page children pages. This query needs to be automatic as I am using in on few pages. This is my query below, but it just returns my posts instead of child pages. <code> <?php $parent = new WP_Qu... | You have to change <code> child_of </code> to <code> post_parent </code> and also add <code> post_type => 'page' </code> : WordPress codex Wp_query Post & Page Parameters <code> <?php $args = array( 'post_type' => 'page', 'posts_per_page' => -1, 'post_parent' => $post->ID, 'order' => 'ASC', 'or... | wp query to get child pages of current page | wordpress |
I'm trying to get this less manual than it currently is. I want to display tags that appear in only a single category, so if they are in a post that has two categories, I want that tag ignored. The following code works, but is a little clunky. Ideally I'd like to be able to skip having to add the excludes and just have... | This loop starts by fetching all posts in given category. then goes through each tag of current post, fetches the posts for each tag, and if all of the posts have 0 or 1 category, prints that category. So, if you have lots of tags, lots of posts, this could be slow-ish. <code> function wa_60126_pl8_artist_list($catname... | Display tags that only appear in one category | wordpress |
I have a wordpress website, on the front page i have an area below the main menu which takes a post and displays it along with an image, what i would like to do is swap this box for the nivo slider. <code> http://79.170.40.241/shaddersafrica.com/ </code> The problem is, this area of the website isn't controlled through... | If you want to add Simple Nivo Slider to a post you can use this shortcode <code> [snivo] </code> -- this is from the instructions at http://wordpress.org/extend/plugins/simple-nivo-slider/installation/ If you want to place it on your homepage ... you can edit your theme files (probably content-single.php) and this cod... | Add simple Nivo Slider to wordpress site | wordpress |
I am in need of a function that automatically generates and returns salts for Wordpress wp-config.php (Don't link me to their API, I'm looking for offline solution). Does Wordpress core has this function defined somewhere? If it doesn't, can these salts be generated randomly or are there any specific rules for creating... | Does Wordpress core has this function defined somewhere? While I haven't used it, you are probably looking for wp_salt or <code> wp_generate_password </code> . <code> wp_salt </code> is located in <code> wp-includes/pluggable.php </code> . can these salts be generated randomly Yes, of course. are there any specific rul... | Generate Wordpress salt | wordpress |
Pretty straightforward question! What does wp-list.js do? It's listed in the wp_enqueue_script codex page as one of the WP included javascript libraries. Thanks! | This file is for list manipulations with jQuery: add, delete or dim list items. It was introduced in Ticket #4805 to replace some prototype code. Attached to the ticket is a sample plugin which holds the actual documentation. It doesn’t work really good … line 461 should be: <code> $id = isset ( $_POST['id'] ) ? (int) ... | What does wp-list.js do? | wordpress |
I'm using the following code to show the single most recent post on my landing page: <code> <?php if (have_posts()) : ?> <?php if (($wp_query->post_count) > 1) : ?> <?php while (have_posts()) : the_post(); ?> <?php the_excerpt() ?> <?php endwhile; ?> <?php else : ?> <?php wh... | <code> <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a> <?php the_excerpt() ?> <?php endwhile; else: ?> <p>Nothing to see here.</p> <?php endif; ?> </code> This is the right synta... | the_excerpt not showing posts | wordpress |
I want to use the Jetpack Carousel for all my posts without editing all of them. Is there a way to show pictures in the carousel even if they're not in a gallery? | Adding another better solution: This displays only the first image in a gallery, linked to launch the carousel. You would make that first image, and it's caption, clearly indicate it as a link to a gallery. Give gallery an HTML ID: <code> <div style="display:none"> [gallery include="111,222,333"] </div> </c... | Using Jetpack carousel w/o creating a gallery | wordpress |
i am newbie with php , i need help to create function to add it in thematic theme content area from this code ? <code> $term_slug = get_query_var( 'term' ); $taxonomyName = get_query_var( 'taxonomy' ); $current_term = get_term_by( 'slug', $term_slug, $taxonomyName ); $args = array( 'child_of' => $current_term->te... | Thanks for help i found the solution <code> <?php /** * Page Template * * … * * @package Thematic * @subpackage Templates */ // calling the header.php get_header(); // action hook for placing content above #container thematic_abovecontainer(); ?> <div id="container"> <?php // action hook for placing cont... | add function to thematic hooks | wordpress |
I am looking for a way to add some custom classes to the admin menus using PHP. For example, here are the li tag for Posts and Pages: <code> <li id="menu-posts" class="wp-has-submenu wp-has-current-submenu wp-menu-open open-if-no-js menu-top menu-icon-post menu-top-first"> <li id="menu-pages" class="wp-has-sub... | The following does the job: <code> add_action( 'admin_init','wpse_60168_custom_menu_class' ); function wpse_60168_custom_menu_class() { global $menu; foreach( $menu as $key => $value ) { if( 'Posts' == $value[0] ) $menu[$key][4] .= " custom-class-1"; if( 'Pages' == $value[0] ) $menu[$key][4] .= " custom-class-2"; } ... | Add a Custom Class to Admin Menus | wordpress |
I'm trying to create an auto search jQuery function by using AJAX to send data to the database and back to the search field. In my wordpress theme, I create a folder called "include" and in there I created a file called "autoSearch.php" In that file I have my PHP code like so: <code> global $wpdb; $searchQuery = mysql_... | UPDATE, Correct Answer: The core WordPress functions are inaccessible at time when using AJAX calls. The proper way to handle this is covered in "AJAX in Plugins" on the Codex. Original answer that didn't solve the issue but might be interesting for others some day. Here's an alternate way that avoids having to directl... | wp_query() get_col error | wordpress |
I created a plugin that sends an email: <code> $subject = 'New comment - '.$post_title; ob_start(); include(SUBSCRIBE_USER_BASE_DIR . '/email/message.php'); $message = ob_get_clean(); foreach($user_emails as $user_email){ $to = $user_email; $send_mail = wp_mail( $to, $subject, $message ); if($send_mail){ echo 'Mail sen... | Ok, so I switched the image root path from <code> define('SUBSCRIBE_USER_BASE_DIR', dirname(__FILE__)); </code> to <code> define('SUBSCRIBE_USER_BASE_URL',plugin_dir_url(__FILE__)); </code> and this worked. <code> dirname(__FILE__) </code> registers: <code> <img src="/var/www/html/internal/wp-content/plugins/AV_-_Su... | Images in wp_mail not showing | wordpress |
I'm wondering how the number of downloads displayed in the plugin-directory correlates to the number of actual websites using the plug-in. I realise some people will download and never install and that others might download multiple times, but if a plug-in has been updated 5 times from the WP dashboard are these update... | That's the total number of downloads. It includes direct downloads in the Repository and installs/updates done in the dashboard. Quotes from Otto comments in this 2010 article about the stats charts in every plugin's page. [...] the download count includes direct downloads as well [...] There is no “raw count” anywhere... | Does the number of downloads displayed for a plug-in in the WordPress.org plug-in directory include automatic updates? | wordpress |
I created the following function that I am using to load single post views: <code> // Post function basey_single_post() { global $post; ob_start(); echo apply_filters('basey_page_title_news', __('<h1>News</h1>','basey')); ?> <?php basey_post_before(); ?> <article <?php post_class() ?> id="... | Most likely, that <code> comments.php </code> file is being included or required more than once. You can make sure that any call to that file is done with <code> include_once </code> or <code> require_once </code> to prevent that issue. Otherwise, a safe workaround would be to wrap the file contents with: <code> if ( !... | Output Buffer Issue with Single Post View | wordpress |
I want to hide and rename <code> wp-login.php </code> in my URL for branding purposes on a Multisite set up. From this forum post I see that I can change <code> mysite.com/wp-login.php </code> to <code> mysite.com/login </code> by inserting a <code> RewriteRule ^login$ wp-login.php </code> in my <code> .htaccess </code... | First things First ... The Rewrite Rule Basically all this rewrite says is (say it out loud) ... when I type <code> mysite.com/login </code> and hit enter, then take the user (rewrite) to <code> mysite.com/wp-login.php </code> This is not a URL mask or URL Forwarding which is what you are hoping for. Second Part ... Af... | How to Rename wp-login.php for Multisite? | wordpress |
Is there an easy way to add another 'read more' link? I'm using the standard 'continue reading' link for some posts but I also want to use a different text like 'more info' for other posts. Can I do this using <code> the_excerpt </code> ? Later update: This are the two standard twentyelven functions that are used for t... | How about using condition to change the readmore links. Here is an sample code which returns a different read more text based upon the category of post. You should read the official codex page to know more about other conditional tags you can use in wordpress. Usage - put this code into your theme's <code> functions.ph... | Different 'read more' links | wordpress |
I've done a lot of research and learned a lot about WP constants and function usage for getting image paths etc. but still my original problem persists. <code> <img src="<?PHP echo WP_PLUGIN_DIR . 'vertical-social-buttons/images/facebook.png'?>"> <img src="<?PHP echo WP_PLUGIN_DIR . 'vertical-social-b... | Use <code> plugin_dir_url() </code> to get the public URI for the directory where the calling PHP file is. <code> <img src="<?php echo plugin_dir_url( __FILE__ ) . 'images/facebook.png'; ?>"> </code> If the PHP file is in a sub directory of your plugin you have to go up: <code> <img src="<?php echo pl... | How to call images from your plugins image folder? | wordpress |
The short version: Any link from Facebook to a page stops evaluating at the "hardcoded page" in the wordpress press install, ignoring the remaining parts of the URL. It doesn't allow the shortcode I wrote, that autogenerates the content on a page for any realestate listing in an external table, to evaluate. The Long Ve... | The problem is that the canonical url on all of those pages is <code> http://www.lbjrealestate.com/property/ </code> . You either need to generate a custom canonical link for your pages, or provide an og:url tag for Facebook to read. Enter your url in the debugger to see what Facebook sees. | How to get wordpress link to fully evaluate when coming from facebook | wordpress |
I'm customizing another plugin by changing the rewrite rule, from: <code> add_rewrite_rule('^api/auth/([0-9]+)?/?','index.php?__api=1&uid=$matches[1]','top'); </code> to: <code> add_rewrite_rule('^api/auth/','index.php?__api=1','top'); </code> After making the change (and not forgetting to refresh the permalinks ) ... | So I've solved this problem, but I'm still scratching my head about the "solution": <code> add_rewrite_rule('api/autho/?$','index.php?__api=1','top'); </code> This version of the rewrite rule works for some reason. I'm guessing that there's some sort of namespace conflict that I accidentally stumbled across. Maybe <cod... | add_rewrite_rule behaving strangely | wordpress |
I would like to write my own little plugin for language switching. For that, the very first thing would be to get the rewrite rules running. I have been looking around the web for 2 hours, but I couldn't find an answer to my question yet. I would like to have it like this: <code> http://www.mysite.com/de/post-title/ </... | I got it now , After searched many resources : <code> function lang_support() { return array('en','fr'); // Add your support lang-code (1st place is a default) } function rewrite_lang(){ $langs = lang_support(); foreach($langs as $lang) { add_rewrite_endpoint($lang,EP_PERMALINK|EP_PAGES|EP_ROOT|EP_CATEGORIES); } } add_... | Rewrite Rule for Multilingual Website, Like qTranslate? | wordpress |
Is there a way to insert images into a post title? It would also need to display the alt text in the <code> <title> </code> tag, permalinks, etc. The reason I need to do this is I have a client who want their logo used in page titles instead of plain text. Therefore, the image could be anywhere in the title, so I... | A search and replace solution does sound viable. I wouldn’t do it via JavaScript, though. <code> add_filter('the_title', 'wpse60174_logo_in_title', 10, 2); function wpse60174_logo_in_title($title, $post_id) { // Add a <span> around the company name return preg_replace('~\bCompany\s+Name\b~i', '<span class="com... | Images inside post title | wordpress |
I used the the following script (only with get_permalink....) to display posts from a post type where the post author has an extra meta field on his user page: <code> <?php // get users from user page $blogusers = get_users(); foreach ($blogusers as $user) { if(get_field('races','user_' . $user->ID)) { while(the_... | Thanks for the ideas. Finally I came up with a quick solution that seems to give the right numbers in the format I need. I'm sure there is a cleaner method to get results from a query like this, but I haven't seen anything similar so far. <code> <?php // get users from user page $blogusers = get_users(); $i = 0; for... | Count total number of post in foreach loop | wordpress |
I'm wanting to create a custom post type that can upload 2 images to display on the home page of a website. How would I attempt this? The images needs to be displayed underneath each other. Thanks! | Use this plugin http://wordpress.org/extend/plugins/types/ Add two custom fields to upload image. Assign this custom fields to custom post. Use short code to display it. Other simple solution is to use custom fields for images.And display them where you want. | Custom Post Type to Upload Images | wordpress |
I just have submitted one of my simple WP Widget to the Wordpress Directory. http://wordpress.org/extend/plugins/wp-twitter-trends/ I want to add Plugin Title Image as like in http://wordpress.org/extend/plugins/contact-form-7/ How can I add that? From readme.txt file? How? | Very simple, All you need to create a image of size exactly <code> 772×250 </code> pixel and name it as <code> banner-772x250.jpg </code> . You have to save this image in <code> /assets/ </code> folder in your plugins SVN directory. Make sure the image is of either <code> .png </code> or <code> .jpg </code> type. The <... | Custom headers for the WordPress plugin directory | wordpress |
I followed the steps to create a lightbox gallery. The gallery is created, but does not open with the lightbox. It just opens as a post. Does anybody know the step I've missed? Here is the site in progress. (I also must mention that pretty much nothing in this theme I bought seems to work) http://www.gregtaylordesignst... | It seams like you forgot to set the Gallery Settings > Link thumbnails to: Image File! Go to edit page/post click on edit gallery inside of your editor and at the bottom you'll find the Gallery Settings. Hope that helps. | Lightbox Effect Not Working | wordpress |
I followed these instructions: http://codex.wordpress.org/Pages#Creating_Your_Own_Page_Templates My understanding of those instructions was that the file snarfer.php needed to be in the folder 'themes', so it appears in the same list as the following folders and file: twentyeleven (folder) twentyeleven-child (folder) t... | Yes, templates files belong to a theme and therefore into the theme directory. The Codex text is a bit vague currently. You should edit that until it is easy to understand. :) | Where to put snarfer.php? | wordpress |
I can't write comments to new articles (no <code> add comment </code> link available). I use Wordpress 3.4. I checked the discussion properties and they are set to allow guests to comment articles none of the other (relevant) options are checked I have the feeling that comments aren't available since I installed some p... | Comments might have been closed once. If you change this option later globally it doesn’t affect existing posts when comments were turned off per post. To test if comments really work create a new post and enable the discussion meta box on that screen: If you can comment while all plugins are disabled and the theme is ... | Comments deactivated | wordpress |
I created a Page Template following these instructions: http://codex.wordpress.org/Pages#Creating_Your_Own_Page_Templates When I create some text in a test page and apply the template I created using the instructions at that link, the text I create doesn't show up when I go 'view page'. What code do I need to add to th... | Your template must have the <code> the_content() </code> function called within the Wordpress loop to show up the text you've entered while creating new post. You might have missed the <code> the_content() </code> function in your custom template, that function retrieves and show the content of your page. Here is sampl... | How to make text show up - new page template | wordpress |
I have a WordPress installation running since ages ago at mydomain.com. It's mostly administered by someone else, so I haven't really had to understand the inner workings of WordPress—I can create and edit content, but I don't mess around in the code. Today I created a new site using the multi-site features, located at... | You can set your homepage in Wordpress by creating your page (the slug doesn't matter) and then going into <code> Settings </code> > <code> Reading </code> and selecting the page in <code> Front page displays </code> > <code> Front Page </code> setting. | WordPress multi-site: How do I create the home page, the root URL? | wordpress |
Is there an easy way to change the words <code> wp-content </code> that show in the source code to <code> xyz-content </code> without breaking my site? I want to do it for branding purposes. I tried: Url rewriting but the original <code> wp-content </code> still shows in the source code. Doing a site download, find and... | You can move the wp-content directory to a different location, which essentially renames it. First, in your wp-config.php file, add this: <code> define( 'WP_CONTENT_DIR', $_SERVER['DOCUMENT_ROOT'] . '/folder/path/to/new/dir' ); </code> And second, also in wp-config.php, add this: <code> define( 'WP_CONTENT_URL', 'http:... | Changing wp-content to other name? Multisite set up | wordpress |
Building my first theme from scratch in Wordpress 3.4.1, I know Wordpress already has the latest version of the JQuery via Google. I have read about issue's if the script is not called properly, so want to try and keep everything as close to the recommended coding as possibly. I want to make sure the script is loaded w... | You're on the right track, but missing one piece: <code> add_action('wp_enqueue_scripts', 'my_scripts_method'); </code> add_action allows you to run code at specific times during page loads / specific events. The above action tells WP to run your function when it is adding the scripts to the html head element. Your fun... | Enqueue jQuery in WordPress | wordpress |
I checked justin tadlocks custom profile field tutorial and wanted to add the field in the custom dashboard widget but it seems it's not working. I want to show all the user information in this widget. All that I want to do is add the custom information from the profile field to this dashboard widget and it seems to be... | There's <code> get_the_author_meta() </code> for such a task. ( <code> get_* </code> functions normally don't echo/print the output - hence the name). <code> // Both values are *optional* get_the_author_meta( $field, $user_id ); </code> Normally it's only meant to be used inside a loop to get the data of the posts auth... | Custom User Field in Dashboard Widget | wordpress |
I have a taxonomy search form and the link output is <code> http://localhost/wp/?cityid=16 </code> But i want it to be rewrited as <code> http://localhost/wp/cityid/16 </code> .htaccess <code> # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase /wp/ RewriteRule ^index\.php$ - [L] RewriteCond %... | Try this code: <code> function geotags_add_rewrite_rules($wp_rewrite_rules) { global $wp_rewrite; $rule_key = '%cityid%'; $url_pattern = '([^/]+)'; $query_string = 'cityid='; $wp_rewrite->add_rewrite_tag($rule_key, $url_pattern, $query_string); $url_structure = $wp_rewrite->root . "cityid/$rule_key/"; $rewrite_ru... | Rewrite rule for a query string | wordpress |
Below is my code for enqueue my scripts and css. I am trying to get the JavaScripts to load in the footer of my site, but when I view source I see them loading in the header. I suppose the "true" value isn't working properly or I have sequenced the code incorrectly? <code> // Enque CSS and JavaScript if (!is_admin()) {... | You need top put it into an actual function and then call the function via an action, but to answer your question. <code> wp_register_script('easy-slider',get_bloginfo('template_directory') . "/js/easySlider1.7.js", true); </code> Your setting the third parameter to <code> true </code> but that param is for the <code> ... | wp_enqueuescript won't load in footer even with true value set? | wordpress |
I'm trying to give a class to every third list item on my page. I know how to give a class to every item, but not to specific items in a row, or in my case - the third. This is the code I am using: <code> <?php $pages = get_pages('child_of=10'); if ($pages) { echo '<ul class="projectthumbs">'; foreach ($pages ... | add a simple counter and conditional check: <code> $pages = get_pages('child_of=10'); $counter = 1; if ($pages) { echo '<ul class="projectthumbs">'; foreach ($pages as $page) { if ($counter == 3){ $class = ' class="YOUR_CLASS"'; $counter = 1 }else{ $class = ''; $counter = $counter +1; } echo '<li'.$class.'>... | Apply class to every third list item? | wordpress |
I am using this simple snippets to get post view count for a long time I was wondering if we can add a "time" data ? Because I would like to show the view of yesterday/ 2 days ago / 2 days ago etc... ? we can display in sidebar like MOST POPULAR POSTS OF THE DAY , MONTH or HOURS (if possible) here is my sidebar code <c... | Well, the code you are using to count views does store the count data as a <code> custom_field </code> value. If I want the functionality you mentioned in question, I'd rather use a custom plugin to create a separate table in database to store view count and respective dates. So doing some queries you can display popul... | How to add "time" data this? | wordpress |
Hi I have this code for custom post types <code> add_filter( 'pre_get_posts', 'my_get_posts' ); function my_get_posts( $query ) { if ( is_home() ) $query->set( 'post_type', array( 'post', 'page', 'album', 'movie', 'quote', 'attachment' ) ); return $query; } </code> i added it to my functions.php file, it works but i... | Found a solution, and it does more than what i asked. This solution shows the custom post types that you want to appear on the homepage and the second half shows it in the archives and search results :) <code> add_filter( 'pre_get_posts', 'my_get_posts' ); function my_get_posts( $query ) { if ( is_home() && fal... | Custom post type code hides navigation | wordpress |
I cloned a remote site on my local MAMP. I fixed pretty much all isues like permission issues and timthumb cache issue used by my Woothemes Fresh News theme. The only issue now is that the backend is not working properly. I cannot add tags nor pick existing ones. I cannot load the featured image I picked and so on. Whe... | Had to remove the folders <code> wp-admin </code> and <code> wp-includes </code> and add them again. Now all good. Somehow some of the files did not tag along during the migration. Has been a long time since I had this issue so did not think that would happen. But it did. This was because two different users have uploa... | Localhost load-scripts.php Error 500 in Dashboard | wordpress |
I have the following code in attempt to check for an image before an echo. The reason for doing so is if there is no image it won't echo anything and there won't be a missing image link put in a post that has no image. However this code does not work and when no image exists a missing image icon is added. Is there anot... | wrap the html output in the conditional like this: <code> <?php $image = wp_get_attachment_image_src(get_field('post_image1'), 'thumbnail'); if( $image !=false ) { ?> <img src="<?php echo $image[0]; ?>" alt="<?php get_the_title(get_field('post_image1')) ?>" /> <?php } $image = wp_get_attachme... | How to check for images before echo | wordpress |
I wanted to create a plugin to batch manage posts' custom field data. I know I can add post meta by add a meta box in post edit screen and use add_action('save_post','function_to_update_meta') to trigger add meta functions. But I don't know how to trigger the add_post_meta function in a admin menu page (such as a custo... | You will need to use an Ajax function . Which requires javascript to send the form data to your php Ajax function which you can use to run update_post_meta(); Example: Form Html: <code> <form> <input id="meta" type ="text" name="2344" value="<?php echo esc_html( get_post_meta( 2344, '_your_key', true) ); ?&... | How can I add/update post meta in a admin menu page? | wordpress |
I was thinking about either getting a plugin or shortcode to create custom field that shows on user and allows admin to change them and edit the information, not users. For example, if we have wp site where 5 members are registered under admin and there are tasks that admin wants to show in their profile page. so there... | I just found this plugin which allows you to create custom options http://wordpress.org/extend/plugins/custom-options-plus/faq/ You can then place the php code to display the value of the option inside your dashboard for members who are logged in but not administrators. You can display the value as text wrapped in a di... | Custom Fields on User Dashboard? | wordpress |
I did a photo gallery with custom post type. The pagination works correct but, if I click to a category, then it must show all photos of the category with pagination, but page 2 not found. You can test it. http://test.onurunwebsitesi.com Click to Tümünü Göster (Show All) button, and click to deneme (try) category butto... | I did! My new codes: <code> <?php /** * Displays the Pagination in Custom loop * */?> <?php get_header(); ?> <?php global $wp_query; $aranan= $_GET['s']; $kategorim = intval($_GET['cat']); $kateg1= $_GET['kategorisec']; if (intval($kateg1)<0) { $kateg = ""; } else { $kateg = $kateg1; } $myterm = get_t... | What Is My Fault With This WP_QUERY ? [ Pagination Problem ] | wordpress |
When I'm using <code> is_single(); </code> in my <code> <head> </code> section to add some style to website navigation it executes correctly on blog posts but it also executes on single "portfolio" post type posts (so single-portfolio.php and single.php). How do I make it execute only on single.php? | You can use the following instead, <code> if (is_singular('post')) { //your code here... } </code> Where by <code> is_singular </code> is the WordPress API conditional function for testing for the existence of a post type. You can also pass an array of post types if you wish. http://codex.wordpress.org/Function_Referen... | How to detect single.php (but not single-portfolio.php)? | wordpress |
I posted a question about whether it's possible to add a Page in WordPress without headers and footers. Here's that question: stackexchange-url ("Add a Page without header and menus?") So how can I create a static page with none of the WordPress stuff that appears on all the other pages of my WordPress site, and add ht... | Richard To be honest I think you are asking <code> How can I stop WordPress from responding to URL's for static pages that I save in other directories on my server </code> Basically its in 2 files your VHOST (which maps mydomain.com to www/some_folder/ ) your .htaccess file which manages redirects So you can do 2 thing... | How can I stop WordPress from catching URL's for static pages that I save on my server | wordpress |
Is it possible to add a Page in WordPress, so that none of the header or the menus of the site appears on that page? And also so that the stuff in sidebars that's on the rest of the site doesn't appear. And the stuff at the bottom of the page (there's a 'Leave a reply' form on the other pages.) So on this site: http://... | Create a custom Page Template, leave out the get_header(), get_footer(), and get_sidebar() calls in it, and put in your own html header/footer code in the Page template instead. http://codex.wordpress.org/Pages#Creating_Your_Own_Page_Templates | Add a Page without header and menus? | wordpress |
I am want to register a sidebar but i am a little confused about the uses of the id argument in register_sidebar function. Codex says: id - Sidebar id - Must be all in lowercase, with no spaces (default is a numeric auto-incremented ID). Of what use is the id arguement and must it alyways be in numeric form?. | The sidebar ID is used to uniquely identify this specific sidebar. If you don't set it and something creates another, you could find that your sidebar moves somewhere unexpected! It doesn't need to be numeric - you can use strings, too. | what is allowed as an id argument in register_sidebar( $args ) | wordpress |
Problem I have authors page and I need to display a different badge for Authors and Subscribers. Authors on the site have certain abilities that differ from Subscribers and I would like to display a different badge based upon their role. Example So when somebody comes to the site either admin author, visitor subscriber... | You can use <code> get_queried_object </code> to get data in the current author page: <code> <?php $author = get_queried_object(); // uncomment next line to see all author data // print_r( $author ); if( in_array( 'author', $author->roles ) ) : echo "author"; elseif( in_array( 'subscriber', $author->roles ) ) ... | Show different badge based upon the user role | wordpress |
I have created a custom taxonomy called "Club" (a group of people). This enables me to group posts from contributors (like tags). I use the plugin "Quick Post Widget" to let enter their posts form frontend. In Quick Post Widget's form they can choose their "Club" (or enter a new one). Here is my question: How can I let... | It's much simpler than you think. The function you will be dealing with is <code> wp_insert_term </code> as I am assuming you only want to provide basic functionality to add a new term (club) and not update terms I won't cover the <code> wp_update_term </code> function now. The example below is very basic and is intend... | Let users create a new custom taxonomy entry from frontend (without creating a post) | wordpress |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.