question stringlengths 0 34.8k | answer stringlengths 0 28.3k | title stringlengths 7 150 | forum_tag stringclasses 12
values |
|---|---|---|---|
I have a jQuery script attached to the widget.php page via an add_action('admin_footer') call. The jQuery executes fine on widget items that were in place when the page loaded. However, on newly installed widgets (widgets that are added to the sidebar after the page has loaded), the handler does not fire. Any ideas how... | Off topic here, but for the sake of solving your problem: For delegated events, the <code> on </code> part should be <code> jQuery(document).on('click','.toggleExtras', function(e){ </code> | jQuery "on" handler does not fire on newly inserted widgets | wordpress |
i have added the below function in my functions.php in theme folder.. and i refreshed my wp-admin page.. but the sub-menu is not coming <code> add_action('admin_menu', 'register_custom_menu_page'); function register_custom_menu_page() { add_menu_page('View Orders', 'View Orders', '', 'orders/vieworder.php', '', plugins... | The Below Code Work's Clearly <code> add_action('admin_menu', 'register_custom_menu_page'); function register_custom_menu_page() { add_menu_page('Shopping Cart', 'Shopping Cart', '', 'orders/sphsettings.php', '', plugins_url('orders/small_cart_icon_20.gif'), 100); add_submenu_page( 'orders/sphsettings.php', 'Coupon Man... | Adding Menu & Sub Menu In Wordpress Not Working | wordpress |
I want to list x number of categories. I'm using <code> wp_list_categories </code> function, it generates the following markup <code> <li class="cat-item cat-item-1"><a href="#">Uncategorized</a></li> <li class="cat-item cat-item-2"><a href="#">Category 2</a></li> <li ... | List of possibilities You got exactly two options to alter the output of <code> wp_list_categories() </code> Use a filter after the MarkUp was generated and re-format it: <code> add_filter( 'wp_list_categories', 'wpse88292_reformat_list_cats', 10, 2 ); function wpse88292_reformat_list_cats( $output, $args ) { // Reform... | Edit the markup of categories list | wordpress |
I´m using this code: <code> <?php // get portfolio $args = array( 'post_type' => 'portfolio', 'posts_per_page' => 100, 'orderby' => 'title', 'order' => 'asc' ); $loop = new WP_Query( $args ); $port = array(); while ( $loop->have_posts() ) : $loop->the_post(); $idx = get_the_ID(); $year_completed = ... | You have to do a small bit of magic to get the url with the correct size image: <code> $image_url = wp_get_attachment_image_src( get_post_thumbnail_id( $idx ), "size" ); </code> You should put in the appropriate thumbnail size for "size" at the end, of course :) Sounds like you'd want "full". Make this a variable in yo... | Link to full size post thumbnail | wordpress |
I have some post ids in an ID array, like: <code> $ids = array(20,34,65,126) ; </code> There is many custom post types in my project, these ids are related to different post types, but I dont know which id is related to which post type in that condition. In another word, I need to do something like this: <code> $posts ... | I am assuming this-- "That function has to be eliminate ids which is not a producy"-- means "I only want to pull the post associated with the ID if that post is a product". In that case a simple query should do it: <code> $pqry = new WP_Query( array( 'fields' => 'ids', // if you only want the Post IDs 'post_type' =&... | Get Posts From A Certain Post Type In An ID Array | wordpress |
I have a new Wordpress 3.5.1 install (hosted on Dreamhost FWIW) that I do not want to be indexed by search engines. I would like to serve a simple robots.txt with <code> Disallow: / </code> for all user agents. I have checked the "Discourage search engines from indexing this site" box on the Settings > Reading menu, bu... | First of all, in order for Wordpress to generate a robots.txt for you you must be using a non-default permalink structure. Make sure you've selected an option in the Settings > Permalinks menu. Also, if a robots.txt file exists at your root directory it will override the setting in Wordpress. It looks like you already ... | Add robots.txt to root | wordpress |
I am redesigning a theme options panel but when I present to a client, the display is not exactly the same with the one I made. I investigate on this problem and it seems that he is actually seeing a part of the old version of the theme options panel so a full clearing of the browser cache should solve the problem. I h... | Browsers will cache any files so it's hard to know without more detail which files are your issue. That said, this happens most often with CSS and JS files, and WordPress is built to address this issue. wp_enqueue_style and wp_enqueue_script each have a parameter for file version (4th param in each). So long as you use... | Theme options not displaying correctly after theme update | wordpress |
I am loving the ACF (Advanced Custom Fields) plugin repeater field but I have two pages in my WordPress site that have sections which share exactly the same data. Obviously one of the key aspects of a CMS is that when such a situation as the one above arises, the client should only have to update that shared data in on... | The ACF functions accept a second argument which is the ID of the page you wish to retrieve the fields from. See the code examples in documentation . <code> $page_id = 120; if( get_field( 'treatments', $page_id ) ): while( has_sub_field( 'treatments', $page_id ) ): // the_sub_field and get_sub_field don't need a post i... | How to share repeated fields across multiple pages? | wordpress |
I use _x() now! I accepted the answer just because he understood right and was first. So don't get confused! <code> $like_me_on = __('Like me on %s', 'my-plugin'); $like_us_on = __('Like us on %s', 'my-plugin'); $follow_me_on = __('Follow me on %s', 'my-plugin'); $follow_us_on = __('Follow us on %s', 'my-plugin'); $my_... | It's interesting idea and I think that such approach will work for you. What I would recommend you is that it will be better to use constructions like this: <code> // $singular = 1 - for 'me', 2 - for 'us' $like_on = _n('Like me on %s', 'Like us on %s', $singular, 'my-plugin'); </code> In this case it will be easier to... | Should i use _n for pronouns in translation? | wordpress |
I am doing the following in my plugin: Register a custom admin page and in the callback function (the last parameter of <code> add_submenu_page </code> ) Redirect to another page However, when I open the custom admin page I get the following error: <code> Warning: Cannot modify header information - headers already sent... | You can't redirect to another page, because WordPress has already rendered admin header and sidebar templates. If you really wish to redirect users to another page, you need to do it earlier, before header and sidebar are rendered. You can use action of following structure to redirect to another page: <code> load-{pare... | Can Not Redirect from Plugin-Registered Admin Page | wordpress |
I currently have a sidebar with a search-form at the top. When the user types in a keyword, when submitted the user is took to a page with search results with posts relating to them words in each article. At the moment, when a keyword is not found, they are sent to a page which shows the title 'nothing found' and a mes... | Not sure it is a smart thing* to do but it is possible. The easy solution is to check if you have any posts and if not redirect based on the referer At the top of your code (before the call to <code> get_header </code> ) add <code> if ( !have_posts() ) { if (isset($_SERVER['HTTP_REFERER'])) { wp_redirect(301,$_SERVER['... | Search results when none found - stay on page they were on | wordpress |
In my <code> functions.php </code> I have defined the following: <code> add_theme_support( 'post-thumbnails' ); set_post_thumbnail_size( 475, 475, true ); </code> I have used the Regenerate Thumbnails plugin to regenerate the thumbnails. When calling <code> <?php the_post_thumbnail(); ?> </code> , the images do n... | I've figured this out. Appears as though I really wanted <code> add_image_size('post', 475, 475, true); </code> and then reran the Regenerate Thumbnails plugin. After sorting out a permissions error on <code> /wp-content/uploads </code> , this worked great. Then in my theme, I just displayed this image size for the pos... | Resizing old post thumbnail images | wordpress |
There are over 200 posts tagged with the keyword "Apple." Each tag page -- example.com/tag/apple/page/2/ -- shows 10 posts. So there are 20 tag pages. Is it possible to show all these 200 post (links) in one page? I don't want to show any of the excerpt -- just consolidate all those 200 links in one page. Appreciate yo... | This is what I would consider the correct solution, and is the solution alluded to by Milo's comment (if I am not mistaken). <code> function alter_ppp_for_tags_wpse_88337($qry) { if ( is_tag() && $qry->is_main_query() ) { $qry->set('posts_per_page','-1'); } } add_action('pre_get_posts','alter_ppp_for_tags... | Showing all the posts in one page? | wordpress |
I am trying to figure out why my sidebar is no longer working. I tried reinstalling my theme, disabling all of my plugins, and uploading a fresh version of widgets.php, with no luck. I am using the Photogram theme, but the problem doesn't go away if I change to a different theme. Here is what I see when I go to my widg... | uploading a fresh version of widgets.php which widgets.php? I guess you updated wp-admin/includes/widgets.php ? you actually need to update wp-includes/widgets.php where dynamic_sidebar function defined in. | Sidebars are no longer working | wordpress |
I have following code <code> <?php $args = array( 'post_type' => 'attachment', 'numberposts' => 12, 'post_status' => null ); $attachments = get_posts( $args ); if ( $attachments ) { foreach ( $attachments as $attachment ) { echo '<li><a href="'.get_permalink( $attachment->ID ).'">'; echo wp_g... | The Problem is that you query for Post Status <code> null </code> . Try setting this to <code> publish </code> or <code> inherit </code> , because <code> get_permalink </code> is a function for published items, not for any post status. This is because Permalinks to items with a status like <code> draft </code> should n... | get_permalink to attachment not working | wordpress |
I'm searching for a fast way to develop a backend for Mobile Apps. The idea is to use Wordpress as a backend. My problem is: How can i serve the information to the Mobile App? I saw the JSon plugin but you can't use it for custom post types. I was thinking at xml, is there a plugin i can use or should i code specific p... | You could use WP and all it's associated goodness for a mobile app backend (I'm going to do it soon myself). Custom post types are not a problem. Make a page, grab the data with a WP_Query and serve up the query results as JSON instead of HTML, though you'll have to do this bit yourself I'd wager (I'm planning on doing... | Using Wordpress as a Mobile App Backend | wordpress |
I've been trying to figure out if it is possible to override the output of the Yoast SEO breadcrumb class rather than editing the original file? Each url segment is wrapped in <code> <span></span> </code> but i'd like to wrap it in <code> <li></li> </code> Is this possible? Any pointers in the r... | In cases like this, open the plugin files in a good code editor and search for the elements you need, as there may be an useful hook. So, for this we have the filter <code> wpseo_breadcrumb_single_link </code> . Maybe you can replace <code> span </code> for <code> li </code> in <code> $link_output </code> , or use <cod... | Override methods in Yoast SEO breadcrumb class | wordpress |
I am writing a basic gallery plugin for WordPress. In the plugin users can mark images as favorites and there is a page where users can see their favorites. I want to setup some rewrite rules for the galleries (domain.com/page/gallery/gallery-name) instead of query string variables (domain.com/page/?gallery=gallery-nam... | I finally got my rewrite rules to work here: <code> $home = get_post(Sunshine::$options['page']); // Gallery add_rewrite_rule($home->post_name."/gallery/([^/]+)/page/?([0-9]{1,})/?$",'index.php?pagename='.$home->post_name.'&sunshine_gallery=$matches[1]&paged=$matches[2]','top'); add_rewrite_rule($home->... | Rewrite rule help for gallery plugin | wordpress |
On my site, commenting is not enabled. But at the top of each blog post (except for one, strangely), there's a 'Leave a reply' link. (the link doesn't do anything -- but the words 'leave a reply' sitting there obviously make it look like you can leave a reply...) I don't see any 'discussion module' in my edit-post page... | Maybe you have forgotten to wrap the <code> comments_popup_link() </code> with <code> if ( comments_open() ) </code> <code> if ( comments_open() ) : comments_popup_link( [...] ); endif; </code> | Comments turned off, but 'Leave a reply' link still there | wordpress |
I would like to put the "more" link in it's own div and am having some trouble... my current code looks like: <code> the_content("<div class='more'>More &gt;&gt;</div>"); </code> But the problem is that the output is not cross-browser compatible...Safari and Firefox render this fine, placing the <co... | I found a solution on the WordPress forums, if anyone is trying to do the same thing here is the solution: http://wordpress.org/support/topic/custom-read-more-text-wrapped-in-a-div I added the following to my functions file: <code> function wrap_readmore($more_link) { return '<div class="post-readmore">'.$more_li... | Wrap More Link in Div | wordpress |
I've added infinite scroll support of the Jetpack plugin to my own theme with: <code> add_theme_support( 'infinite-scroll', array( 'container' => 'content', 'footer' => false, 'render' => 'vividflow_infscroll_render', 'wrapper' => false, 'posts_per_page' => 12 ) ); </code> The <code> vividflow_infscroll_... | The problem indeed was that there were several posts on the bottom. Adding this to the end of the loop helped: <code> <br style="clear:both;"/> </code> I think this is a bug in the Jetpack plugin, but it is easily resolved by adding this line break. | Infinite scroll loads new posts several times | wordpress |
I've created a CPT, added capabilities to it and them to the Subscriber role successfully. However the mapping is clearly not working because I get errors on publish and a Subscriber cannot edit their own posts (which the function below allows if they are the author). Why won't my map_meta_cap function work? I've spent... | Turns out it's a real bad idea to map your own meta capabilities. To solve this problem I ended up going through the steps you would with a map_meta_cap function with TWO plugins. Use [Map Cap] to automatically map the meta capabilities of my new custom post type to my specific user roles. Then had to install the Very ... | Custom Post Type's Capabilities map_meta_cap issues | wordpress |
I've noticed that since WP 3.5 that we now have the Backbone.js and Underscore.js libraries included. The new Media Modal uses Underscore templates and I was wondering how would I be able to insert them, especially in the admin side of things.Is there a correct way to insert these? | Your plugin index file: <code> add_action( 'print_media_templates', 'wpse8170_admin_footer' ); function wpse8170_admin_footer() { require 'templates.php'; } </code> Your templates.php: <code> <script id="tmpl-mytemplate" type="text/html"> <h1>Hello {{data.name}}!</h1> </script> </code> Your medi... | Using Underscore Templates in WordPress | wordpress |
So I'm creating a plugin to create buildings that list condos for sale. The simplest way to do this was to just create a custom post type for the buildings and then the listings but I'm now stuck on how to display them in an archive. I've done something similar while developing themes where I would just create a archiv... | Include your template files in your plugin. I stick mine in /plugin/templates. You need to hook into template location for that template: <code> add_filter('archive_template', 'yourplugin_get_custom_archive_template'); function yourplugin_get_custom_archive_template($template) { global $wp_query; if (is_post_type_archi... | How do you create an archive for a custom post type from a plugin? | wordpress |
I have WooCommerce running on this store . Although the default is to show 12 products on a page the client has asked for a "show all" button that will prevent the user having to use pagination to get to the other products. Is there a function I can run on the current page that will rerun the loop but change the query ... | Just add the conditional check to your <code> functions.php </code> file: <code> if( isset( $_GET['showall'] ) ){ add_filter( 'loop_shop_per_page', create_function( '$cols', 'return -1;' ) ); } else { add_filter( 'loop_shop_per_page', create_function( '$cols', 'return 12;' ) ); } </code> | Show all products on one page with WooCommerce | wordpress |
I have changed the <code> /author/ </code> slug to <code> /profile/ </code> by adding the following code in the file <code> functions.php </code> : <code> function new_author_base() { global $wp_rewrite; $author_slug = 'profile'; $wp_rewrite->author_base = $author_slug; } add_action('init', 'new_author_base'); </cod... | Add this to 'your' section of the <code> .htaccess </code> file (so not in the WordPress section): <code> Redirect 301 /author http://yourdomain.com/profile </code> | 301 Redirect /author/username/ to /profile/username/ | wordpress |
Good evening! I'm trying to hide the featured image caption from showing. Currently, it'll show build the div (but not populate it because it's empty). What I'd like to do, ideally, is only show the div if someone has entered text in the Caption ( <code> post_excerpt </code> ) box in the Media Panel. This is the code I... | In 'if ($thumbnail_image && isset($thumbnail_image[0])) {' - should '$thumbnail_image[0]' not be '$thumbnail_caption'. | Getting Featured Image Caption to Only Show if Populated | wordpress |
I can't work out how to add the WP quicktag button back into the editor, I have customized the editor as below: <code> function gimko_format_tiny_mce($in) { $in['remove_linebreaks']=false; $in['convert_newlines_to_brs']=false; $in['keep_styles']=true; $in['tabfocus_elements']='major-publishing-actions'; $in['paste_remo... | Not sure why this was so hard to answer, but after more research & playing around I have found the answer - for anyone else that is wondering, you just use <code> wp_more </code> in any of the <code> theme_advanced_buttons </code> indices. | Get the More QuickTag button back | wordpress |
I have been trying to import something into a custom field using the WordPress Import tool but it seems to be leaving the custom field empty in the database. <code> <wp:meta_value><![CDATA[a:19:{s:7:"address";s:50:"52, St. Michaels Rd,Sheffield,S359YN";s:11:"gpsLatitude";s:18:"";s:12:"gpsLongitude";s:18:"";s:1... | I have recently had a lesson in serialized arrays from a friend and it all makes sense now! After working this out it finally worked on the import. Take this for example: a:1:{s:7:"address";s:50:"52, St. Michaels Rd,Sheffield,S359YN";} a:1: This is the array size, there is one piece of information in this array hense t... | Importing from XML is ignoring serialized custom field | wordpress |
I'm trying to fire two different actions on both publish and update. Neither should ever fire at the same time. The problem is that <code> publish_pm_task </code> is getting fired on update and <code> save_post </code> is never getting fired? See anything wrong with this? <code> <?php // Updated task notification ad... | First of all you have to understand that when we update a post, <code> wp_update_post </code> function is called. But due to a bit not optimal design of WP core, the actual saving is processed by <code> wp_insert_post </code> function. See it in trac on line 3006 . Ok, next lets see what is inside of <code> wp_insert_p... | Why does publish_{custom-post-type} fire on update? | wordpress |
I added a variable to my functions.php file: <code> $options = get_option( 'simple_options' ); </code> I can access to this variable on every page, but If I call it in the footer.php it's not working. How to fix that? | Generally, you cannot access local variables in a function from outside the function, so this... <code> function func() { $var = 2; } $var = 1; func(); echo $var; </code> would result in "1". To make a global variable, you can do this to make <code> $option </code> available outside <code> functions.php </code> : <code... | How to access a variable on all page? | wordpress |
I want enable a user to only edit specific post. I am using the members plugin. I do not see a way to achieve this. Do I need to do some code for that post? Thank you! | the Short and sweet way would be to store the post id that they are allowed to edit in custom user meta. Then us wp_update_post and check if the id is in the user meta if so update if not don't. | How to change user role setting in members plugin so that user can only edit his own post? | wordpress |
What does the <code> user_trailingslashit() </code> function do, and when should I use it? How is it different from the <code> trailingslashit() </code> function? | The <code> trailingslashit() </code> function adds a <code> / </code> to the end of a URL if it lacks one. <code> user_trailingslashit() </code> uses the permalink template as set under Settings > Permalinks to decide whether to add or remove the trailing slash from the end of the URL For example, if you had the permal... | What is user_trailingslashit() for? | wordpress |
I'm currently building a theme for a client, and one of their requirements is endless scrolling on a "Charts" page. They want this to be paginated, and the endless scroll to load the next page below the first, displaying the most popular 40 tracks posted on the site. To achieve this, I used a new WP_Query, which is run... | The script never hits a 404 so it continues to load. If I am looking at this correctly it won't ever hit a 404, and it shouldn't ever hit a <code> 404 </code> . You are loading a page template, the finding and loading of which is going to be done by the main query. That page is always going to be found-- ie, not <code>... | Paginated WP_Query doesn't return 404's, even when posts don't exist | wordpress |
Background: I have a few plugins in the WordPress directory and have recently made the decision to team up with another individual to grow one plugin faster. I'm planning on adding him as a plugin author, but I want to be sure that if I do so there's no risk of me "losing control" of my plugin. Question: If I add anoth... | You can add the author as contributor and all I know, he does not get automatically write access to your svn repository. You can also just mentioning the other author without adding him as contributor. My personal opinion is, if you're worried that the other author steals your code, then he is the wrong helper. | Adding Second Plugin Author | wordpress |
I can't seem to remove the "Continue reading..." link in my rss feed. The feed is located here: http://gforge.se/category/r/feed/ I use the <!--more--> tag manually and I've checked that the Settings-> Reading-> For each article in a feed, show: Full text but I guess this is only for the automated WP summary functio... | Ok, so it turns out that I needed to use the <code> the_excerpt_rss </code> filter and to modify the code so that it only applies to the R category I just added a <code> is_category("R") </code> . Below you can find the altered Full Text Feed plugin: <code> function ff_restore_text ($content) { if ( is_feed() & is_... | Full text articles in the rss feed (i.e. without the more tag) | wordpress |
I am teaching British Sign Language on my website, on the alphabet section I have an image of 'signs' that spell out a word. Below I would like a text box that requires the user to input the correct word and for the text box to validate live and appear with a tick next to it. Much like the functionality of the 'Homepag... | If you are looking for a shortcode like this: <code> [question text="What has four legs?" answer="Horse" message="Right answer!" messageid="message1" ] </code> with output like this: then here is a very simple non-jQuery skeleton version: <code> add_shortcode('question','question_func_wpse_88192'); function question_fu... | Wordpress live, custom text box validation, how to? | wordpress |
I am using Jquery Hover Footnotes plugin that allows adding footnotes and dynamically displays them on hover-over. In other words, I use <code> {{FOOTNOTE_NUMBER}} </code> , Then I embrace the actual footnote text with double brackets <code> [[FOOTNOTE_NUMBER]] Footnote text [[FOOTNOTE_NUMBER]] </code> . the plugin wil... | I think that what you need to do is find where your custom meta data is displayed and do this: <code> echo jqFootnotes(get_post_meta($post_id, $key, $single)); </code> That will run the <code> jqFootnotes </code> filter on your post meta, and I think that will do what you need (assuming that <code> $post_id </code> , <... | Footnotes in custom fields | wordpress |
I've written a shortcode plugin. Basically the plugin has the following structure: <code> PL::setup(); class PL { public static function setup() { add_shortcode("myshortcode", array ( __CLASS__,"myshortcode_handler")); } public static function myshortcode_handler( ... some variable assignment? if (time the shortcode is... | I your shortcode callback <code> myshortcode_handler() </code> use a static variable: <code> function myshortcode_handler() { static $first_call = TRUE; if ( ! $first_call ) { # callback was called earlier … } # set it to FALSE after you have handled the condition. $first_call = FALSE; return; } </code> Please do not m... | how to check if a shortcode is used more than one time in the same post | wordpress |
For future reference : I am using the great Meta Box Plugin to help expedite meta box creation for my custom post types. My goal : To build a highly customizable events section closely resembling a traditional calendar like <code> get_calendar </code> creates, but for a specific custom post type. The Problem: — B... | This isn't complete copy/paste code, but hopefully it's understandable enough to get you started. First step is to register your post type and add a rewrite rule to handle years/months. This will give you single events at <code> event/post-name/ </code> , your post type archive at <code> calendar </code> , and handle i... | How to sort CPT by custom meta value (date), and return posts month by month | wordpress |
I'm developing my own theme. Does WordPress recommend or require a minimum or maximum when it comes to the width of the content or sidebar elements of an post, page or archive page? If not, are there any unofficial guidelines? | There are no recommended sidebar widths, however there are LOTS of plugins that make assumptions about this (especially those that handle advertisements). If you plan on running ads, please check the ad width requirements and use that as your baseline. For example, if you are running AdSense ads and the ad requires 300... | Recommended sidebar / content widths | wordpress |
I need to change the menu color of the wordpress 2011 theme to transparent. this is the header <code> <nav id="access" role="navigation"> <h3 class="assistive-text"><?php _e( 'Main menu', 'twentyeleven' ); ?></h3> <?php /* Allow screen readers / text browsers to skip the navigation menu and g... | Is this the answer you're looking for? Go to your .css file and replace this <code> #access { background: linear-gradient(rgb(37, 37, 37), rgb(10, 10, 10)) repeat scroll 0% 0% transparent; box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.4); clear: both; display: block; float: left; margin: 0px auto 6px; width: 100%; } </code> ... | How to change the menu color | wordpress |
i have a custom taxonomy defined for "Projects" and a page that shows all the projects. In this page there's a jquery filtering menu (isotope). Initially the page must show all the projects but chronologically ('chronological' is a category and 1970, 1980, 1990, etc are subcats for a Projects element) ordered in DESC m... | If you are trying to order your posts by taxonomy terms, it's not technically possible in one query (since multiple terms can belong to multiple posts - which means that WordPress cannot support 'orderby' for taxonomies or terms because there are potentially more than one). Your solution would be: Fetch a list of your ... | query_posts and custom taxonomy posts order | wordpress |
Good Day. I am using a Gallery shortcode in my wordpress site to display images. Problem is that I wasnt the gallery to show only images from a certain category, for example category id 35. How do I specify it in the shortcode? Shortcode: <code> [custom_gallery style="1" source="**cat=%cat_id%**" link="image" descripti... | This may do.. <code> [custom_gallery style="1" cat="35" link="image" description="0" size="200x200" limit="10"] </code> | Wordpress Gallery shortcode: Display one category ID only | wordpress |
The Jetpack image widget does not offer a target option for links. Is there a way to open all Jetpack image widget links in a new window without hacking the plugin? Like through a hook or function? | There is no hook available in the plugin. One solution is to simply copy this Jetpack Widget and add the target option. Another is through jQuery, in the file <code> /theme/functions.php </code> : <code> add_action( 'wp_enqueue_scripts', 'jetpack_widget_wpse_88067' ); function jetpack_widget_wpse_88067() { wp_enqueue_s... | How can I get the Jetpack Image plugin to open links in a new window? | wordpress |
I tried google and used #wordpress. Is there a way to preset categories for my new posts (post-new.php) via GET-parameters? If not how can I achieve this? | Dublicate question. But I think my question + link will help some ppl out. stackexchange-url ("How to add category to: 'wp-admin/post-new.php'?") | Preset categories in wordpress by GET-paremters | wordpress |
Just installed Better WP Security (with File Change Detection feature activated), then logged out. Now wp-login.php is blank with the message : Notice: unserialize() [function.unserialize]: Error at offset 0 of 93 bytes in /home4/mysite/public_html/wp-content/plugins/better-wp-security/inc/secure.php on line 20 What ca... | Rename the directory in which the plugin resides to disable it | Better WP Security : dashboard doesn't work any more | wordpress |
I can't find the answer. I don't know how many people are allowed to use SAME account at the SAME period of time in WP. Will it cause any technical issue, if the specific account is allowed to post? What if its NOT allowed to post? THank you! | i won't claim this is a canonical answer, but I don't know of any specific limit. I log in from several computers regularly and it doesn't seem to matter. Certainly you could exhaust server resources and things like that, but I don't know of anything WordPress specific that would limit it. I would expect problems if mu... | How many people are allowed to use same wordpress account at the same time? | wordpress |
Based on an example found here and several others, I am trying to load a non wordpress page from a specific URL while having access to the wordpress core. I have the following code (which seems to work as expected) to hook into the <code> template_redirect </code> action: <code> function templateRedirect() { global $wp... | I do this pretty regularly and have no issue with using functions in WordPress core. You can hook a bit earlier though and skip the 404 and header bits. In <code> functions.php </code> : <code> function wpa88013_parse_query( $wp ){ if ( 'nlm-admin-thumbnail' == $wp->query_vars['pagename'] ) { include( dirname( __FIL... | How do I attach a php file to an arbitrary slug and still have access to the wp-core functions? | wordpress |
The template I used as a start for my own design places the metadata inside the header tag of the single-post.php. Is that a correct use of header, or should there only be h-tags in there? What about the post image? Could that be part of the header? | The w3 specification says that only h-tags are allowed inside of the hgroup-tag. The basic purpose of it is to group a main-headline and a sub-headline together. <code> <hgroup> <h1>My maintitle</h1> <h2>Subtitle of my content</h2> </hgroup> </code> edit html5 also adds the header -t... | Does post-meta belong in header? | wordpress |
I am still learning settings API so please forgive my noob question. I have three fields: a checkbox, colorpicker and text field (they are working ), but I would like to do this: when the theme is installed add "checked" state to my checkbox but allow user to "unchecked" it ,and if empty add default color to my colorpi... | You can pass defaults to <code> get_option </code> . The second parameter is a fallback. <code> $default </code> (mixed) (optional) The default value to return if no value is returned (ie. the option is not in the database). <code> Default: false </code> So, for example, instead of: <code> $options = get_option('plugin... | Settings API enable default settings on theme install? | wordpress |
I am trying to remove menu items from the backend but for some reason I can't remove specific menu items added by plugins. For example, I can use this line to remove the plugins page and it works just fine: <code> remove_menu_page('plugins.php'); </code> I have a plugin, CW Image Optimizer, that adds a sub menu under t... | I'll assume you're calling it in your functions.php file? If that's the case, likely the plugin is adding the menu item after you're call is being called. Try placing it in the admin_init() hook, at the very end. <code> if ( ! function_exists( 'remove_wp_menu_items' ) ) { function remove_wp_menu_items() { remove_submen... | Can't remove menu items added by plugin | wordpress |
My index page look like this... <code> <div id="ad-id">google ad code goes here </div><br /> <div id="post-id">My posts are goes here</div> </code> I use <code> get_template_part('index') </code> in another page template. But I want index's posts only NOT google ads. Help me.. Thanks in ad... | In your <code> index </code> template, you'll want to add a conditional around your Google ad. The subject of that conditional is up to you, and will depend on your exact needs. For instance, if you want it to show on the homepage but not other pages, you can check if <code> is_home() </code> . If your needs are more a... | Conditional get template part | wordpress |
I created a custom taxonomy, "partners". I would like to categorize these items, so I created a custom post type with a taxonomy. <code> register_taxonomy("partners-category", array("partners"), array("hierarchical" => true, "label" => "Partners", "singular_label" => "Partner", "rewrite" => true, "slug" =&g... | You have to create an template file called taxonomy-{name}.php to show the posts assigned to a custom taxonomy. So in your case it should be taxonomy-partners-category.php . Category related archive pages work only with "Posts". Info: http://codex.wordpress.org/Template_Hierarchy . Scroll down to Custom Taxonomies disp... | How is it possible to list custom post types by "category" like with simple posts? | wordpress |
Before asking the question I want to tell you that I have already asked the question in stackexchange-url ("stackexchange-url I am using the WooCommerce plugin to develop a website. Everything is fine with WooCommerce. As per my requirement, I have configured my home page as a shop base page from the WooCommerce dashbo... | By going through your question I want to tell you that woocommerce will not use your custom template. It will use its own template. As you want to use wordpress advanced custom fields plugin I want to tell you is that feature only works on the page and post. So as woocommerce will not allow to use your own custom templ... | WooCommerce shop page to use my custom template | wordpress |
Every one knows the basic WordPress loop, every one knows that if you want just posts in a loop you put <code> query_posts("post_type=post"); </code> BEFORE the loop. which I have done. The problem is I have a custom post type, called mini feeds, which shows up in my loop, the problem is, its the only thing that shows ... | At first, not everyone knows, but definetly should know, that there is a pre_get_posts hook which should, in most cases, be used instead of query_posts. Further, defining only one custom post type results in bringing just one custom post type. It's correct. When one want to bring both, custom post type and posts, one s... | Custom Post type showing up in loop, regular posts are not showing up | wordpress |
I know it should work with custom table and I think it worked in previous development I believe. But this time I don't know whey it is not getting custom table with <code> $wpdb->tablename </code> Code: <code> global $wpdb; $items = $wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM $wpdb->review_media"));... | <code> $wpdb->tablename </code> works only with the tables initially present in a WordPress installation. These tables are defined in <code> wp-includes/wp-db.php </code> . The second method you used is perfectly acceptable. | wpdb-> not adding prefix to custom table | wordpress |
I want to create and admin area that allows you to add, reorder, and remove existing posts to a 'featured' category by selecting from a dropdown menu that has a list of categories and posts in that category, preferably with a drag and drop functionality. Would this be done with a custom post type? If so, can anyone dir... | While it's not exactly what you're asking for, check out Zoninator . It does everything you're asking except that it doesn't use categories. I'm guessing you just wanted to use categories to target a featured area of the site, and if so, this does that extremely well. It even has a widget for listing the posts, so no c... | Organize Existing Posts from the Admin Area to a New Category | wordpress |
I'm trying to create an archive-photos.php template for my photos custom post type. The problem I have is that when I view the page it is the archive.php template that is used, not the archive-photos.php. I simply want the archive-photos.php to be used when viewing the archive page for that specific custom post type. W... | as determined in the comments, the page URI is <code> ?post_type=photos&genre=boudoir </code> ... The reason why <code> "archive-{$post_type}.php" </code> isn't used in this case is because the page is a taxonomy archive and not a custom post type archive. WordPress is looking for <code> taxonomy-genre.php </code> ... | My archive-posttype.php template is not loading | wordpress |
I have created a new custom post type and some custom fields for it. My function for saving the custom meta fields fires on the 'save_post' hook. The problem is that I am getting a warning when I go to add a new post: Notice: Undefined index: my_meta_box_nonce.... <code> // verify nonce if ( ! wp_verify_nonce( $_POST[ ... | I know that this is not the only tutorial that has code that check nonce for meta boxes but this is truly idiotic. Nonce should be checked per the whole action not per parts of it and if your save_post hook was called it means that the save nonce was already checked and found valid, so There is no need for more securit... | Nonce check causing issues when creating new post | wordpress |
I would like to get this: <code> mysite.com/category/tag/ </code> example: <code> mysite.com/news/sports/ </code> News is a CATEGORY and sports is a TAG How can I do it? Thanks. | WordPress is practically setup to support this out of the box. You can go to <code> mysite.com/?category_name=news&tag=sports </code> to see the magic happen. All we need to do here is match a permalink structure to this existing URI, and WP makes this unreasonably easy. In your theme's functions.php file, add: <co... | Advanced permalinks structure | wordpress |
My site is running slow, because the file "admin-ajax.php" is loaded many times. see screenshot here: http://f.cl.ly/items/2b0O3Q0X27433X2F2j3U/Bildschirmfoto%202013-02-23%20um%2014.13.14.png Here the functions.php file: http://f.cl.ly/items/3e2D070u2M310W1J321K/Bildschirmfoto%202013-02-23%20um%2014.19.46.png How can i... | For everybody else: It has been the plugin zilla-likes in combination with the Hoarder Theme. I deactivated the plugin. | admin-ajax.php loading many times | wordpress |
I have a plugin that inserts some rewrite rule in the .htaccess file. However, upon deactivating it, doesn't remove said rule. The rule is nested in <code> # BEGIN My plugin </code> and <code> # END My plugin </code> . I want to create an uninstall.php file for this plugin to remove the rule created on acrivation. I've... | How do you add your rewrite rule? If you are adding it manually (opening the .htaccess and adding the lines by yourself in php) then you are also supposed to remove it manually. As you suggested the best way would then be to use regex. If the rewrite rule was added through the Wordpress API using add_rewrite_rule() you... | Remove .htaccess portion upon plugin deactivation? | wordpress |
I've fixed my initial problem but I'd like to know what I was doing wrong. <code> <?php $args = array( 'post_type' => 'page', 'post__not_in' => array( $post->ID ), 'post_parent' => '43', 'post_count' => '3', ); $my_related_posts = new WP_Query( $args ); ?> </code> Displays 4 results, where I expect... | <code> post_count </code> is not a parameter of WP_Query argument. <code> post_count </code> is a property used to get the number of posts being displayed. For example, <code> echo $my_related_posts->post_count; </code> will display the number of posts being displayed. | post_count not working | wordpress |
I have a custom post type with no Title field. These are short status messages, where only the content matters. The RSS feed and permalink display the title as Auto Draft, which is not very useful. Ideally, it would have the post content, or at least the first 10 or so words. I've tried this function, but it still appe... | I think <code> save_post </code> action hook is the proper one. Maybe you'll want to insert some checking if the post title is already set ( <code> $post_object->post_title </code> ), as this code always update the title according to the content. <code> add_action( 'save_post', 'save_post_wpse_87921', 10, 2 ); funct... | How can I automatically insert the page content as the title? | wordpress |
Is it possible to have any control over the screen options for <code> Appearance>Menus </code> . I am working on a theme and with a fresh Wordpress install where I had never touched any of the screen options ( at least not under Appearance> Menus anyway ). I had 3 custom post types. Of these one was "missing". I inv... | This option is stored in the <code> wp_usermeta </code> table with the <code> meta_key </code> name of <code> metaboxhidden_nav-menus </code> . If we hide all the boxes, this is the <code> meta_value </code> of the option: <code> array( "nav-menu-theme-locations", "add-custom-links", "add-post", "add-page", "add-portfo... | Set default screen option for appearance -> menus | wordpress |
I'm not sure if I'm doing this the right way.. I want to display 4 random images as part of the header of a page. I created a post called Header Images and inside it is a gallery with a bunch of images. Then inside my header.php I have <code> $args = array( 'name'=>'header-images', 'numberposts' => 4, 'orderby' =... | Try this: <code> $args = array( 'name'=>'header-images', 'posts_per_page' => 4, 'orderby' => 'rand' ); </code> i.e. use <code> posts_per_page </code> instead of <code> numberposts </code> if you want to use <code> query_posts() </code> according to the the Codex page: http://codex.wordpress.org/Function_Refere... | limit number of images shown from gallery | wordpress |
I've been putting together a simple WordPress plugin that employs a sidebar widget and shortcode. One user has reported the following error when trying to activate the plugin on their local WP installation: Plugin could not be activated because it triggered a fatal error. Fatal error: Class 'Example_Widget' not found i... | You should not need to instantiate the widget class at the top of your code, because of the register_widget function hooked from your main class does that work for you. EDIT: Wordpress already instantiates your class. | Plugin won't activate, fatal error (widget class not found) | wordpress |
I have a function on my site that it supposed to run when a new post is published (email push notification), with the exception of the same article updated (i.e <code> publish_to_publish </code> transition, I don't want to send unnecessary push notifications) I know that I can use the {old_status} to {new_status} actio... | If not, how do I tie multiple hooks to the same action? Do I just list them like so: <code> add_action('new_to_publish', 'save_new_post', 10, 1); add_action('future_to_publish', 'save_new_post', 10, 1); add_action('draft_to_publish', 'save_new_post', 10, 1); </code> This is exactly the way to go. Just hook the same cal... | Detect type of post status transition | wordpress |
I'm working on a plugin that will create a custom post type for press releases. The objective is to give the user the ability to easily create a press release in the standard press release format. An example would be: FOR IMMEDIATE RELEASE Title Here City, State (Month Year) - Paragraph 1 Paragraph 2 So on... Contact: ... | http://codex.wordpress.org/Function_Reference/the_date When there are multiple posts on a page published under the SAME DAY, the_date() only displays the date for the first post (that is, the first instance of the_date()). To repeat the date for posts published under the same day, you should use the Template Tag the_ti... | Custom post type RSS feed, multiple post published on same day bug | wordpress |
I've got a problem with the jQuery supplied with WordPress. The following HTML exhibits this problem: <code> <!DOCTYPE html> <html> <head> <script src='http://wordpress.myownserver/wp-includes/js/jquery/jquery.js?ver=1.8.3'></script> </head> <body> <div id="something"><... | There is a difference with the version of jQuery supplied with WordPress as outline on the Codex page for <code> wp_enqueue_script </code> : Note: The jQuery library included with WordPress loads in "no conflict" mode. This is to prevent compatibility problems with other javascript libraries that WordPress can load. Ch... | Weirdness in jQuery supplied with WordPress | wordpress |
I have the below code in <code> front-page.php </code> (with that page set in Settings > Reading); however, something is wrong because the posts aren't showing. The output is shown below. Can someone identify what the problem may be? <code> <?php get_header();?> <section id="home-content"> <section id="l... | Turn your Settings-> Reading Blog and Home page back to default. Front-page.php is pulling your homepage content instead of your posts because you've told it to in your settings. front-page.php could also display the latest posts on your homepage, but if you've altered the settings so that a Static Page is your homepag... | Output shows a page instead of a list of blog postings | wordpress |
I am trying to access the bookmarks created by a single user. The key is stored in the links table, attribute link_owner. However, get_bookmarks() seems to load the entire table and all I am left with is to parse the table and filter the rows with a matching userid. For my application I expect the number of links to be... | It looks like the default <code> get_bookmarks() </code> http://codex.wordpress.org/Function_Reference/get_bookmarks is using this query: <code> SELECT * FROM wp_links WHERE 1=1 AND link_visible = 'Y' ORDER BY link_name ASC; </code> You can check the function in <code> /wp-includes/bookmark.php </code> . The <code> get... | querying user bookmarks from a large number of bookmarks | wordpress |
OK, I'm hacking my way through my first theme (while reading Prof. WP Design & Development 2nd Ed.) and .... EVERY TIME I change -for example- a p tag or a div tag or a css rule, when I then go to reload the page to see changes ... I....wait....and....wait.... for the dang page to reload!?! I'm seeing "cache issue"... | From the comments above, it seems the problem is caused by a plugin. You can try to search for the error message (cache issue?) within the plugin files. Some editors and IDEs have a function "file search" which searches in every file. E.g. in Notepadd++ you can do a file search by hitting [ctrl]+[f]. If you found the e... | WordPress Page Reload Takes forever during theme development | wordpress |
I was building a theme options page with the settings API. I use an ajax call to compute some settings automatically from other pages / tabs. I noticed that all of the new settings default ("std") will display in their input fields but will be undefined when I make the ajax call using : <code> array_merge(get_option('s... | Don't rely on the options ever getting saved. Better is for the Theme to function normally, whether or not the user ever visits the Theme Settings page. First step is to define a function to return your option defaults, either: Define them in the function, and then reference that function in your option parameters arra... | Theme settings default, strange behavior before first save | wordpress |
Since a week or two I keep receiving the following automatic email message sent from my WordPress website, and I'd like to know if it indicates any security hole and if there's anything I can do to stop it : "A host, 79.148.238.85(you can check the host at http://ip-adress.com/ip_tracer/79.148.238.85 ) has been locked ... | It looks like you have the plugin <code> Better WP Security </code> http://wordpress.org/extend/plugins/better-wp-security/ installed with the <code> Enable login limits </code> feature activated here <code> /wp-admin/admin.php?page=better-wp-security-loginlimits </code> . You can configure the plugin to stop sending y... | Too many login attempts | wordpress |
Im using the blankslate template theme and have a sidebar which i would like to use throughout the website. On my sidebar on the homepage i have a widget called latest posts with the latest post snippet and a read-more link. When this is clicked, the user should be able to view the single post on a new page with the he... | When checking each template include, the single footer contained an error. To resolve this, i duplicated the code from the index footer and amended for the single template. Thank you for your replies. | Single template will not show sidebar/bottom-nav and footer | wordpress |
I found this PHP code that will set the first attached image as the post thumbnail. stackexchange-url ("stackexchange-url Is it possible to loop through old posts that have attachments using WP_Query() to set the post thumbnail for old posts? If the post has more than 1 attachement, I'd like to set the first attachment... | The first step is to loop through all the posts: <code> $wpse87964query = new WP_Query(); </code> Now, that will get all the posts; but we're only interested in posts that don't have a featured image set. WordPress stores the featured image via a post custom meta field: <code> _thumbnail_id </code> ; so, we can use tha... | WP Query to set post thumbnail for existing old posts | wordpress |
I would like to remove the following from the search results page, I'm using the ET Chameleon theme which doesn't have a search.php file in the editor section. Any help greatly appreciated. <code> Posted by auscov on Feb 22, 2013 in | 0 comments </code> | If the theme doesn't have a <code> search.php </code> file, <code> index.php </code> will be used. Template_Hierarchy Template file used to render a Search Results Index page search.php index.php [update] Use the following to print the current template being used to render a page: <code> add_filter( 'the_content', 'so_... | How to remove date, author and comment count from Chameleon search results page | wordpress |
I have a <code> register_nav_menus </code> call in my theme's functions.php: <code> //register nav menu and footer nav. register_nav_menus( array( 'main-nav' => 'Main Navigation', 'footer-nav' => 'Footer Navigation' ) ); </code> This works fine, but I'd like to take the extra step of programatically creating a me... | Figured out how to do this based on an answer to this question : stackexchange-url ("Programmatically add a Navigation menu and menu items") I adapted my answer to suit my own needs, i.e just to create the nav menu and assign it to the location I'd already defined: <code> //register nav menu and footer nav. register_na... | register_nav_menus, then create menus programatically | wordpress |
This is actually my first question here, so hello to everybody in this community! I have developed a theme with a custom post type and a template (lets call it "my_template.php") that shows posts of this custom post type in an archive-like fashion. What I'm trying to achieve is to make a permalink in the navigation of ... | You could see if a custom page template fits your needs. Create a Page with the desired permalink, then set its page template to "my_template.php", and you're good! | Permalinks that go to a specific template | wordpress |
Within one plugin file I have several calls to the same option in the database via get_option(). Does WordPress do a database query every time I use get_option()? Would it be better to get the option once and store it in a global variable? | Wordpress will only do a database lookup the first time if the option hasn't been auto-loaded or already accessed prior. The performance hit is negligible, however if you're loading multiple separate options with a bunch of get_options instead of using the serialised option functionality, then the initial lookup * X nu... | Caching of SQL queries | wordpress |
If I have a paid blog at wordpress.com, can I install plugins manually on it? Or must I have my own wordpress installation? Thanks! | Short answer - no, not really. Though there are already a lot pre-installed and you can suggest new ones if you'd like. Check this article out: http://en.support.wordpress.com/plugins/ | Can I install plugins manually on WP.com? | wordpress |
I'm customizing a custom theme to use WooCommerce. One of the issues I've run into is adding a span tag around a product title on the single product page. I've figured out how to add a filter to the <code> the_title </code> method but unfortunately that method is used in other places like in the product image alt tag (... | Here is how you do it, First remove woocommerce single title action, and create your own function to handle the title, later add back the action using your newly created function. <code> <?php remove_action('woocommerce_single_product_summary','woocommerce_template_single_title',5); add_action('woocommerce_single_pr... | Add a Span Around a Product Title in WooCommerce | wordpress |
Good Day When you are inside the wordpress ctrl panel, and you edit/create posts, do theme changes etc, where does Wordpress store all that content? In which files? Thank you | That information is stored in the MySQL database, not in files like you may be thinking of. They aren't stored in <code> .php </code> or <code> .html </code> files. If you want to "see" how and where that data is stored the easiest way is to browse the database using a tool like PhpMyAdmin. NOTE: Technically, there are... | Where does Wordpress store the users customization in the theme | wordpress |
I have a template which initially had one single loop and it was using query_posts, I added 2 more loops using the same method, However after reading allot about these it was concluded that I shall stop using it and everyone is against using it. original query_posts loop (latest posts) <code> <?php if ( !is_front_pa... | Thanks to tips given by the commentators I was able to achieve this :) <code> <?php if ( is_front_age() ){ $most_viewed_posts = new WP_Query( array('v_sortby' => 'views', 'v_orderby' => 'DESC', 'showposts' => 10, 'cat'=> 3) ); } while ( $most_viewed_posts->have_posts() ) : $most_viewed_posts->the_p... | query_posts() vs get_posts() multiple loops | wordpress |
I guess there's a simple solution for this but couldn't find any. I'm trying to fetch 3 pages and show them on footer. The problem is that every page is shown as text without formatting which means that shortcodes are printed as text as well . Here's the code I'm using: <code> global $wpdb; $sql = "SELECT post_title, p... | You need to run the <code> post_content </code> filters. It is a one line change from your current code. This... <code> echo $footerElement->post_content; </code> ... should be ... <code> echo apply_filters('the_content',$footerElement->post_content); </code> That will give you all the same formatting as with nor... | Print page content with formatting when doing custom SQL query | wordpress |
This might sound an odd one but wondering if the following scenario is possible at all within WP. Would like for example a parent custom post type of : Product Type 1 Underneath it I only want options to have 2 custom post type children within it: News, Reviews (which could be expanded going forward) Product types coul... | Ended up thinking about this from another way creating 2 subtypes {type}_reviews and {type}_news and changing the admin menu putting one under the admin menu of the other. The slugs are then altered using the slug customisation in the CPT settings. | Parent and child custom post types without options on parent | wordpress |
Imagine all the old_functions_that_do_the_same_thing_as_new_functions() being ripped out. Think of the consistency and improved work flow while working with different themes and plugins. Is there already a branch like this or is there something in the pipeline? | There are no such plans. WordPress intentionally maintains backward compatibility. | Any plans for a non backwords compatible WP release? | wordpress |
I have the following code in my functions.php, which executes a script upon publish: <code> function save_new_post($post_ID) { $site_root = '/home/forexmag/public_html/directory2'; $post = get_post($post_ID); $title = $post->post_title; $breaking_news = false; $categories = get_the_category($post_ID); if (is_array($... | Magenta is actually correct. $post_ID is a WP_Post object. Your exec code should effectively be using $post_ID-> ID. <code> function save_new_post($post_ID) { print_r($post_ID); die(); </code> Returns <code> WP_Post Object ( [ID] => ... </code> | getting "Object of class WP_Post could not be converted to string" - when it is a string | wordpress |
Using jquery, the icons of WordPress admin menu have been changed to use the twitter boostrap icons, done such as: <code> jQuery('#icon-themes.icon32').replaceWith('<div style="font-size:22px;" class="icon32 fonticon"><i class="icon-eye-open icon-large"></i></div> '); </code> But I have custom p... | I always like using this tutorial which would give you this code. <code> <?php add_action( 'admin_head', 'cpt_icons' ); function cpt_icons() { ?> <style type="text/css" media="screen"> #menu-posts-POSTTYPE .wp-menu-image { background: url(<?php bloginfo('template_url') ?>/images/YOURIMAGE.png) no-repe... | change the icon of a custom post type in WordPress to use twitter boostrap | wordpress |
I am making a simple HTML form in a plugin I am writing. I was thinking of using <code> echo </code> for all output, but I can't seem to control the formatting of the HTML outputted (for debugging, neat looking HTML, NOT talking about how the page looks to the user). If I have an echo like: <code> echo '<sometag>... | If this is plugin code there is NO REASON the theme would make a difference. My guess is it's a server issue (outputting of <code> /n </code> ) or a WordPress function that changes the <code> /n </code> into <code> <br> </code> I would check <code> wpautop() </code> as I find that sometimes it's this functions fa... | Using the echo command adds unwanted br tags to source | wordpress |
I was hoping somebody could help me out with custom fields. I created a custom post type called game-type in WordPress. In this I have the categories "Android", "iOS" and "PC", then within these I have categories for types of games "3D Action", "Classics", "Platform" etc. So an example hierarchy for each post works lik... | Have you tried using include/exclude ? <code> $taxonomy = 'game-type';... $include = 'ANDROID ID IE: 1' $args = array(... include => $include ); </code> EDIT: vancoder is right: it should be... <code> $taxonomy = 'game-type';... $child_of= 'ANDROID ID IE: 1' $args = array(... child_of => $child_of ); </code> Wher... | Targeting categories in custom fields | wordpress |
I need a <code> <a href="Something Like <?get_contact_page>">Contact Page</a> </code> Code that always links to the Contact page, no matter what is it's ID There's a page template for contact page. Is it possible to do this? I'll gladly provide any further information you need :) Thanks!! | If the contact page is identified solely by the associated template, you can query for a page with the template name in meta key <code> _wp_page_template </code> : <code> $args = array( 'post_type' => 'page', 'posts_per_page' => 1, 'meta_query' => array( array( 'key' => '_wp_page_template', 'value' => 'c... | Dynamic href link to Contact Page | wordpress |
In the book 'Professional WordPress Development' I found this tip: As a rule of thumb, if your options are needed by the public part of the blog, save them with autoload. If they are only needed in the admin area, save them without autoload. Wouldn't that result in many extra SQL queries in the backend if all plugin de... | Quite personally I disagree with the author of the book to an extent. If you are auto-loading multiple options in your database when Wordpress is initialising it's doing a lookup that looks like this: *"SELECT option_name, option_value FROM wp_options WHERE autoload = 'yes'"* — at the beginning. Now, imagine if you had... | Plugin options autoloading | wordpress |
Does anyone have any suggestions as to how I can get the sort by vote count to work with the GD STAR RATING plugin? I have added sorting parameters to a category list on my site but it still isn't ordering the posts by the number of thumbs up votes. http://uhurusoftware.com/category/contest/?gdsr_sort=votes&gdsr_or... | I solved my problem. I needed to change the parameter "votes" to "thumbs". I also found it worked better to show the results in a descending order. Here is the working URL: http://uhurusoftware.com/category/contest/?gdsr_sort=thumbs&gdsr_order=des | sort by vote with GD STAR RATING plugin | wordpress |
There are very many brute-force attacks (mostly for 'admin' username) on WordPress sites. All these attacks are made automatically via post requests. The question 1: how brute-forcer knows that the password is cracked for target username? The brute-forcer try the typical passwords like: '12345', 'qwerty' etc. And often... | The log-in credentials are processed in <code> wp_signon() </code> , and if they are valid <code> wp_set_auth_cookie() </code> will send a cookie in the HTTP response body. The name of that cookie is set in a constant named <code> SECURE_AUTH_COOKIE </code> or <code> AUTH_COOKIE </code> . Both names start with <code> w... | How brute-forcer knows that the password is cracked for target username? | wordpress |
I would like to use the plugin Facebook-AWD plugin. My site would provide two ways of registration (normal and register with Facebook). Users must select their role, ie: buyer and seller . With normal registration, I can achieve this easily but if my users choose to register with Facebook-AWD they can't select between ... | The plugin offers an entry point for this manipulation: $userdata = apply_filters ('AWD_facebook_register_userdata', $userdata); So, now it's a matter of you filling up the fictional function in this example: <code> add_filter( 'AWD_facebook_register_userdata', 'user_role_wpse_87863', 10, 1 ); function user_role_wpse_8... | How to let user select role upon registration in Facebook-AWD? | wordpress |
Hi for some reason my footer is missing on my site, and i don't know why. I have deactivated all plugins and it's still not there, I have checked the css and all, but the footer is still missing can someone tell me whats wrong. When I view the Source Code the Footer is there but It's not showing up. The Site is EricaVa... | Your iframe tag that supplies your Facebook information isn't closed. So the code stops rendering from that tag on. | Why is my footer missing | wordpress |
I am trying to get term ids from term name and cannot figure out why this code is not working. <code> $excludes = ''; if($filtering_excludes) { $exclude_terms = explode(", ", $filtering_excludes); foreach ($exclude_terms as $exclude_term) { $term = get_term_by( 'name', $exclude_term, $filtering_tax ); $exclude_term = $... | Check for variables names: <code> $excludes = ''; if($filtering_excludes) { $exclude_terms = explode(", ", $filtering_excludes); foreach ($exclude_terms as $exclude_term) { $term = get_term_by( 'name', $exclude_term, $filtering_tax ); $exclude_term_array[] = $term->term_id; } $excludes= implode(", ", $exclude_term_a... | Getting Term ID from Term Name for WordPress Query | wordpress |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.