question stringlengths 0 34.8k | answer stringlengths 0 28.3k | title stringlengths 7 150 | forum_tag stringclasses 12
values |
|---|---|---|---|
We've inherited a customer with a good looking Wordpress site but the previous agency didn't fully implement the "Email This" feature. I mean, their theme has a link for "Email this" on every page but there's nothing underneath it. We've been instructed to make it work. So, the ideal would be for a solution which retai... | well wouldn't it be easier to get any plugin working - then go into plugin folder/code and search for the image it uses and replace it with the nice image/themed one ? | Implementing an "Email this" button? | wordpress |
I need to display (for pages that use a particular page template) a list of custom post type objects filtered into 2 sets - those with comments, and those without comments. Each of these sets should display the last 10 of its type (ie the latest 10 posts with comments, and the lastest 10 posts without comments) What's ... | And I should have done some searching before asking. Looks like hooking the query might be the best way of doing this. stackexchange-url ("Here's") a good answer from StackOverflow with practically the same question. | Filter custom posts with / without comments | wordpress |
I'm really having a few issues with inserting terms. Here is my scenario: I have a taxonomy called veda_release_type: <code> //Release Type and Region $labels = array( 'name'=> _x('Release Types/Regions', 'taxonomy general name' ), 'singular_name' => _x('Release Type/Region', 'taxonomy singular name'), 'search_it... | The hierarchy is cached and it's not invalidated properly. This is a bug, still unresolved as of WP 3.1. A workaround would be to call <code> delete_option("{$taxonomy}_children"); </code> directly. See the _get_term_hierarchy() function. | Inserting terms in an Hierarchical Taxonomy | wordpress |
I'm developing a theme, and there's a section for awards & certifications which will consist of just 4-6 small logos. Is there a way to put these images in a category and then display all of these images on the homepage with a simple code so the client won't have to go into the source code? Thanks. | Technically you can't put images in category, because they are not posts by themselves. You can create Custom Post Type for your images, etc, etc (might be overkill in your case). Personally I like to use Links for such stuff. It is ready-made, easy to add images to (just URL), supports own categories and can be flexib... | Is there Photo Categories? | wordpress |
I want implement theme option which will have two css files. Example, if current admin set their profile to blue color I want load blue css for the theme options. <code> if (current-value-css-admin) load blue else load gray </code> Let me know how do I get current data for the wp admin color. | This can be retrieved with <code> $color = get_user_option('admin_color'); </code> , just don't forget to check for empty return and default to something in that case. Native color schemes are called <code> fresh </code> (grey) and <code> classic </code> (blue). | How to get a value for admin css color either gray or blue | wordpress |
How can I create a URL to an admin page (under /wp-admin/) that I'm not adding to the navigation? I want to use the URL for an ajax request. | Hey, changed my google search terms and found my answer. :) http://codex.wordpress.org/AJAX_in_Plugins | How to create a wp admin page (for use in an ajax request) | wordpress |
Following up from stackexchange-url ("Locked out of my own blog and password reset not working"): After posting the question I decided to give the password reset route one last try and this time the e-mail did come through and I was able to get back into the blog. It took me a total of four attempts to reset the passwo... | Unfortunately email can be like that. It works most of the time, but sometimes messages just poof. Especially if email is being sent by some small hosting account (more suspicious) as opposed to large email service (less suspicious). You can try to verify with hosting if emails were really sent, but if they were I don'... | Why would it take four reset password attempts to finally get the e-mail? | wordpress |
I have my own Wordpress installation for my infrequently updated blog. I have a habit of forgetting my password so have to request a new one and reset it every two to three months. I've done it again today and got the "Password Reset" e-mail (which arrives within seconds of requesting it). Following the link to actuall... | If you can get to phpMyAdmin (or something equivalent), open the DB and find the wp_users table. Select the appropriate user to edit and change the user_pass field to <code> whatever </code> . Set the function to MD5 and save. You should now be able to log in. | Locked out of my own blog and password reset not working | wordpress |
Hey, is it possible that i can put a chunk of code somewhere and it will show up after the more tag seperator but within the post ? I mean if i put more seperator after first paragraph then on post areas after that will show up the code i will put.. probably some html with a twitter and rss link. Help is appreicated :)... | k i found the answer on researching and modifying a code i found : <code> add_filter('the_content', 'adds_block'); function adds_block($content){ if (is_single()) // return $content; global $post; $thePostID = $post->ID; $test = '<span id="more-' .$thePostID.'"></span>' ; return str_replace($test, ads(),... | Text after more tag in posts | wordpress |
I am trying to hook into activate_plugin. I know that activate_plugin has 1 required param and 2 optional ones. I am trying to acquire all 3. Here's my setup: <code> // create plugin settings menu add_action('admin_menu', 'pe_create_menu'); function pe_create_menu() { //create new sub-level menu add_submenu_page( 'plug... | The <code> activate_plugin() </code> function accepts three parameters, but it emits the <code> activate_plugin </code> action with only one parameter. This can be confusing, but hooks sometimes use the same name as the function they come from, without passing the same parameters. One way to get the difference between ... | How to get all of the activate_plugin action parameters? | wordpress |
I'm using CMS Press for custom post types. The issue is the feed doesn't validate because lastBuildDate is blank. I am not using WordPress's default posts for anything and that is causing the problem. I did a test post using WordPress's default post and voila lastBuildDate was filled in and the feed validated. As soon ... | This is the solution I found based off of @Rarst's answer. Put this in the themes functions.php and it worked like a charm! <code> add_filter('get_lastpostmodified', 'my_lastpostmodified'); function my_lastpostmodified() { global $wpdb; $add_seconds_server = date('Z'); return $wpdb->get_var("SELECT DATE_ADD(post_mod... | Custom post types - RSS lastBuildDate issue | wordpress |
Wanted to know if there was any documentation or plugins that allowed a site to pull prices and other information from Amazon.com on DVD's and other products. I'm creating a plugin that stores information about DVD releases and I would like to create code that pulls the price from Amazon, and calculates the difference ... | You're looking for something a little more advanced than a simple affiliate integration. Unfortunately, I don't thing there's an existing plug-in solution for the kind of interaction you're trying to achieve. That said, it should still be possible. A cursory search turned up Amazon's Product Advertising API , which see... | Amazon.com intergration with WordPress? | wordpress |
I've recently started using the Hikari Hooks plugin for Wordpress as it seems to allow you to get a good idea of what do_actions are being called on the page, so that you can easily find out where potential hooks for plugin code might lie. Are there better tools/plugins for accomplishing the same thing? In particular I... | It is usually easy to find most hooks in documentation or source. It can be much more tricky for hooks that are dynamically generated, like post transitions. Essentially it doesn't exist in source as specific hook - it is hook that is getting generated dynamically at runtime, depending on variables. <code> do_action("$... | Good tools for locating hooks in a wordpress page/admin interface/blog post? | wordpress |
I'm really stuck on this - this follows on from this post: stackexchange-url ("How to override parent functions in child themes") I can't figure out how to override Twenty Ten's set_post_thumbnail_size() function. I've put my code below for the other overrides I'm doing, but nothing happens when I add this to my functi... | What exactly do you mean by nothing happens ? Technically you don't need to remove <code> set_post_thumbnail_size() </code> , as I understand from code - simply making your own call later will overwrite size. There are two ways you can handle this: Adjust your setup function to later priority. Child theme is processed ... | How to remove set_post_thumbnail_size() in child themes? | wordpress |
Really rusty on the wordpress front. I am using custom permalinks <code> /%category%/%postname%/ </code> as well as the <code> WP No Category Base </code> plugin, so my urls look like this: http://www.url.com/parent_category/child_category/ I only have an index.php set up at the moment, with the most basic loop possibl... | The <code> <?php query_posts(); ?> </code> in your code is causing the global query to be reset to show all posts instead of the one set by your rewrite rules. You should remove that line. | Category links including all posts | wordpress |
My client wants to implement a special appearance to each of our category pages. Kind of like child themes... she wants to shift the background image, change a few graphics, and tweak the colors according to which category the user is visiting (horror, romance, etc). Is there a reasonable way to do this besides creatin... | If changes do not require modifications to HTML markup you can accomplish that by loading conditionally additional CSS style files. See Conditional Tags > A Category Page and <code> wp_enqueue_style() </code> in Codex. | Category specific themes? | wordpress |
Basically that's the question - I wonder if <code> set_transient() </code> overwrites/updates a transient option with the same key? | Yes, key (prefixed with string identifying it as transient) is used as option name when value is inserted in database. | Does set_transient() overwrite/update transient option with same key? | wordpress |
I want to list categories belonging to a parent. The problem is using category id's isn't useful and makes things harder to understand. Is there any easier way to list categories belonging to a parent, similar to the default way supplied in the WP codec? <code> <?php wp_list_categories('child_of=8'); ?> //what ca... | You can get ID from slug quite easily: <code> $category = get_category_by_slug( 'clients' ); wp_list_categories('child_of='.$category->term_id); </code> | Listing Category 'child_of' by slug rather than ID | wordpress |
What function will display custom taxonomies associated with a post as text? I'm currently using get_the_term_list which works great for a singular page but not so much when using a taxonomy in the archive-postype.php permalink title tag. | wp_get_object_terms() returns the terms associated with an object (eg a post or a page or custom post) as text (normally in an array). From the Codex page for wp_get_object_terms() <code> $productcategories = wp_get_object_terms($post->ID, 'productcategories'); </code> | get_the_term_list without links in 3.1 | wordpress |
I'm trying to create a fallback method when ZipArchive is not present. I'm seeking to use the _unzip_file_pclzip() function contained in wp-admin/includes/file.php However, I'm not sure what is expected for the $needed_dirs argument. My target folder for the zip will be the "styles" folder under my theme folder, so the... | @Scott B I have not tested this script, taken from inlcudes/file.php -> line 559 <code> _unzip_file_pclzip </code> assumes WP_Filesystem() has already been called, so you need to set up <code> global $wp_filesystem </code> <code> global $wp_filesystem; $needed_dirs = array(); $target = trailingslashit($target); // Dete... | What should I pass for $needed_dirs when calling _unzip_file_pclzip (aka PclZip)? | wordpress |
publish_post Runs when a post is published, or if it is edited and its status is "published". Action function arguments: post ID. - Plugin API Documentation I've added the publish_post hook to a WordPress plugin that I'm writing. The function called by the hook itself, is meant to change the categories of several posts... | <code> add_action('new_to_publish', 'your_function'); add_action('draft_to_publish', 'your_function'); add_action('pending_to_publish', 'your_function'); </code> | add_action hook for completely new post? | wordpress |
I found a question about magazine style front pages that queries always only 1 post (or custom_post_types, etc.) from a whole load of different categories, tags or custom taxonomies. I thought about this for a while and came with something like this as a start. <code> function pre_saved_posts() { if ( ! is_admin() OR !... | Hi @kaiser: Consider using the Transients API instead, that's what it is built for. http://codex.wordpress.org/Transients_API | pre saved posts query from db options table | wordpress |
I need to obtain a reference to the $wp_filesystem object. In the test below, the var_dump($wp_filesystem) returns NULL. What additional files are required in order to properly set up $wp_filesystem? I was expecting that since its called in file.php, loading that file would be sufficient to load the object. <code> <... | <code> $wp_filesystem </code> is a global variable containing the instance of the (auto-)configured filesystem object after the filesystem "factory" has been run. To run the factory "over" the global variable (so to set it), just call the <code> WP_Filesystem() </code> function which is, guess what, undocumented in cod... | $wp_filesystem returns NULL. What are the dependencies? | wordpress |
I just converted a site to a multisite setup using WordPress 3.0.4. One thing I found in a hurry is that if I wanted to edit a theme's code, the changes would be reflected on all the subsites that use the same theme. Is there a to customize the code so that only a certain subsite receives the changes?? | If it is just css customizations, use this plugin: http://wordpress.org/extend/plugins/safecss/ It's what wp.com uses for their css upgrade. If you have to edit the php, make a copy of the theme with a new name on the theme folder and in style.css. | Customizing 1 theme for multiple blogs in a multisite setup | wordpress |
I am looking to display different content after a user registers. Is there a way to find out the registration date and then if it's been 1 day display one thing, but if it's been 2 days display something else? Something like this, but based on the registration date and not a post entry date: <code> <?php if (strtoti... | Yes you can! <code> <?php get_currentuserinfo(); $user_data = get_userdata($user_ID); $registered_date = $user_data->user_registered; if (strtotime($registered_date) > strtotime('-30 days')){ //Text for users registered in the last 30 days } ?> </code> hope this helps | Find out when a user was created and display varied content depending on time since creation | wordpress |
I want implement upload logo to my theme option page. Currently I follow this code What I have done for now load a related jquery for the media upload <code> function load_only() { add_thickbox(); wp_enqueue_script('jquery-option', get_template_directory_uri() . '/admin/js/jquery.option.js', array('jquery','media-uploa... | You are most likely to save the url of the image and not the whole image tag, and there is a great tutorial that explains just how to use the media uploader in your own theme or plugin: http://www.webmaster-source.com/2010/01/08/using-the-wordpress-uploader-in-your-plugin-or-theme/ update In case of using this in a met... | How to use media upload on theme option page? | wordpress |
I want a more elegant way to express the following redirect: <code> RewriteCond %{REQUEST_URI} ^/blog/2008/(.*) [NC, OR] RewriteCond %{REQUEST_URI} ^/blog/2009/01/(.*) [NC, OR] RewriteCond %{REQUEST_URI} ^/blog/2009/02/(.*) [NC, OR] RewriteCond %{REQUEST_URI} ^/blog/2009/03/(.*) [NC, OR] RewriteCond %{REQUEST_URI} ^/bl... | It is no problem that the posts are already gone, we will hook into WP before it queries the database. First we set up our rewrite rules, which will set a special query variable (that we must declare public), and then, in the <code> parse_request </code> action, we check for that variable and redirect if it is set. <co... | Date based redirects of posts that no longer exist | wordpress |
I need to grab a list of current events. The events have a start and end date so I need to be able to select a range as opposed to just getting any list of events that have an end date that is after today's date. Does anyone have any suggestions as to how to do this? (from what I've read there doesn't seem to be a way ... | You can use your current code to create the query and then in your loop run a check before displaying the events something like <code> <?php query_posts('meta_key' => 'end_date_value', 'meta_compare' => '>', 'meta_value' => $todaysDate); while ( have_posts() ) : the_post(); $post_custom = get_post_custom... | How to get events using multiple custom meta fields? | wordpress |
When I call the WordPress unzip_file() function below, instead of actually extracting the zip, it merely moves it into the target folder. When I trace $file and $to from includes/file.php I get: <code> file: C:\xampplite\htdocs\testsite/wp-content/themes/mytheme/styles/myzip.zip To: C:\xampplite\htdocs\testsite/wp-cont... | Do you have a filesystem and setup that allows for direct access? If the filesystem object is expecting FTP credentials, then you may not get the results you're looking for without giving it the right username/password/server information. | Anyone using unzip_file successfully? It uploads the zip but doesn't extract it! | wordpress |
This code is working fine, just want to make sure I'm ok with hardcoding the href to the category edit screen with... <code> "edit-tags.php?action=edit&taxonomy=category&post_type=post&tag_ID='.$cat_id.'" </code> Or is there a method I should call to get the category edit link dynamically (in case the call ... | The function which is used internally (since 3.1) is <code> get_edit_term_link( $term_id, $taxonomy, $object_type = '' ) </code> . Source view here . There's also a function called <code> edit_term_link </code> that will format the link output for you. The built-in functions are probably better to use, because they che... | Adding fields to category manager. Does a method exist to get the link to the category edit screen? | wordpress |
I have this function: <code> function get_image_link( &$post ) { $image_link_meta = get_post_meta( $post->ID, 'as_link_to_image', true ); $image_link_from_post = ''; if ( function_exists( 'has_post_thumbnail' ) && has_post_thumbnail( $post->ID ) ) { $attachment_image_link = wp_get_attachment_image_src... | This should be able to return the url of the large image. <code> $largeImg = wp_get_attachment_link( $attachment_id, 'large', false ); </code> There's also this incase that doesn't work. <code> wp_get_attachment_image_src( $attachment_id, 'large' ); </code> | Get the url of the full sized attachment image using post ID? | wordpress |
I have a large menu containing 10 parent items with roughly 7 child items each that I am trying to build using the WP-admin > Appearance > Menus. I have nearly all the menu items added but now my wp-admin backend won't save the menu, it keeps timing out and just ending on a blank screen. I have about 4 more items left ... | You can always try to split your menu into 2 separate menus and then just display them next to each other in your theme. It's far from perfect and doesn't help a bit in understanding the root of your problem but it could help. You can use it as temporary workaround to GTD before deadline and then dig deep into memory i... | Large WP 3.0 menu times out and won't save | wordpress |
I was just looking at wp_update_term and haven't found any possibility to update the "name" of the term. My scenario is pretty simple: I got some predefined taxonomy terms in a config file like this (just an example): <code> $taxonomy_terms = array( 'taxonomy_a' => array( 'term_a', 'term_b', 'term_c' ) ,'taxonomy_b'... | According to <code> wp_update_term() </code> in Codex you pass fields you want to override in <code> $args </code> argument, try passing <code> name </code> in there? | wp_update_term: How could i update the "name"? | wordpress |
Is there anyway to assign all new posts that have a custom post_type to a specific category? For example, say I have a post_type that is for Actors. Is there anyway to assign any post that is under Actors to a "People" category? (but without displaying the Category box in the WordPress Admin) | you can first remove the category meta box from Actors post type edit screen like this <code> function remove_custom_taxonomy() { remove_meta_box( 'categorydiv', 'custom_post_slug', 'side' ); } add_action( 'admin_menu', 'remove_custom_taxonomy' ); </code> then create a function that will add the category on save_post <... | Anyway to assign custom post types to a specific category? | wordpress |
How can I make oEmbed work on the excerpt field so I only have to paste the youtube url in there and then be able to echo 'get_the_excerpt()'? I also want to filter oEmbed and change the wmode but I think I found a solution for that here: http://code.hyperspatial.com/all-code/wordpress-code/oembed-wmode/ EDIT: Crap! I ... | Not entirely sure it is supposed to be used like this, but by analogue with <code> the_content </code> try this: <code> add_filter('the_excerpt', array($wp_embed, 'autoembed'), 9); </code> | Making oEmbed work on the excerpt field | wordpress |
I'm working on using the WP API to insert posts via AJAX. What's the proper way of adding tags dynamically to a custom post type? These tags would not be predefined, but rather be created on demand by the user. Currently I'm doing this: <code> $tags = explode(" ", $_POST['post_tags']); $new_entry = array( 'post_title' ... | Hi @James: If you have the post ID of your newly created post (the <code> $created </code> variable from your question) you use the <code> wp_set_object_terms() </code> function, for example: <code> wp_add_post_tags($created,'My First Tag'); wp_add_post_tags($created,'My Second Tag'); wp_add_post_tags($created,'My Thir... | Creating tags via API | wordpress |
(Since my custom post type is a little long, I've for the sake of simplicity, copied over a dummy one) What I am trying to do is, say I describe a few "similar" variables, i.e. price1, price2, price3, etc. would I be able to stack those values in a single column (as opposed to showing it over 3 columns), i.e. <code> $p... | yea you can do just that. you only need to change the output function which in this case is <code> function prod_custom_columns($column){ global $post; switch ($column) { case "description": the_excerpt(); break; case "price": // Now here I have to define the field, but how would I drag in other subsequent price fields... | Custom Post Types: Can you add more than one Variable to a Column? | wordpress |
I've been given the directive to "retire" about 1000 articles from a wordpress site I maintain. Deleting the posts from the DB is trivial, but how would one go about deleting the orphaned files from the uploads folder? | take a look at Upload Janitor plugin. its a plugin i use to clean up unused images and other files from your uploads folder. but just in case make a backup of your uploads directory first | How to delete orphan attachments? | wordpress |
I have two authors pages, one displays about 5 posts. Then I'm trying to setup another page that will be all of their posts. I have created a template called moreauthorposts.php and I'm trying to pass the author variable to this page. Problem is if i pass domain.com/more-author-posts?author=johndoe it gets stripped out... | I'm almost sure that author is built-in so use somthing like author_more so you need to add that var to query_vars first <code> //add author_more to query vars function add_author_more_query_var() { global $wp; $wp->add_query_var('author_more'); } add_filter('init', 'add_author_more_query_var'); </code> then on your... | Passing and retrieving query vars in wordpress | wordpress |
Is there any method to close connection similar to mysql_close() for wpdb in wordpress? Is it not necessary to close connection for global wpdb? | There is no explicit method. It stores link identifier in <code> $wpdb->dbh </code> field, so I guess you could use <code> mysql_close() </code> on it. Why do you need it btw? If you want to reuse <code> $wpdb </code> it is better to create separate <code> wpdb </code> object instead. | How to close wpdb connection? | wordpress |
I have a situation where I need to hide a specific category and it's children from users who are logged in as Contributors. I don't want them to see this category and it's children in the categories meta-box on the add new post screen. I can't find a plugin (that works) to do this, wondering if someone else knows of on... | Hi @davemac: Well, I wrote this before I saw that you answered your own question so I might as well post it anyway: <code> add_filter('list_terms_exclusions', 'yoursite_list_terms_exclusions', 10, 2); function yoursite_list_terms_exclusions( $exclusions, $args ) { global $pagenow; if (in_array($pagenow,array('post.php'... | How can I hide a category from Contributors in the edit/add new post screen? | wordpress |
When someone creates a post in a custom post type and uploads an image the Link URL box shows it as the attachment URL. What I would like is for it to be the permalink to the post. Is there a way to do it without modifying core files? | Hi @kel: Thanks for answering the comments and thanks to @בניית אתרים providing the screenshot; now I have a better idea of what you wanted. Based on what you asked for I think what would be ideal would be for the dialog box to simple generate your preferred URL; that way you don't have to remember to click. You can ac... | Link images to post permalink - custom post types | wordpress |
I searched high and low for a plugin that can remove/hide Admin menu items , including custom post types and taxonomies, based on user role. Every one I have tried only does a global hide, not based on user role. Other more complex ones like adminize do not display custom post types or taxonomies. Do I have to write my... | Update: reading mike's answer again got me thinking that you can add a new capability to a role and use that as you removal condition, so: <code> // first add your role the capability like so // get the "author" role object $role = get_role( 'administrator' ); // add "see_all_menus" to this role object $role->add_ca... | Plugin to remove Admin menu items based on user role? | wordpress |
Man, I can't seem to ever get done with enhancements to WordPress categories. I hope there's more work done on core category options in the future. Especially with the emergence of site theming and siloing of late. I know WP is ahead of most publishing systems in terms of its early support for categories, but it seems ... | Hi @Scott B: From <code> /wp-includes/widgets.php </code> for the <code> WP_Category_Widget </code> class we have the following code (line 438 in WordPress v3.0.4): <code> $cat_args = array('orderby' => 'name', 'show_count' => $c, 'hierarchical' => $h); if ( $d ) { $cat_args['show_option_none'] = __('Select Ca... | Filter Categories widget to allow custom sorting? | wordpress |
i am trying to display comments by specific users at a custom area. i am successful to do that, but the problem is the permalink structure . this code gets the url as permalinks disabled, if i enable the permalinks from my settings , then these urls starts giving a 404. here is the code im using : <code> <? if(get_q... | Hi @Ayaz Malik: You need to use the function <code> get_comment_link() </code> . I've rewritten your code using some improved techniques and included the function call in place of what you had: <code> global $wpdb; $sql =<<<SQL SELECT {$wpdb->comments}.comment_ID, {$wpdb->comments}.comment_post_ID, {$wpd... | Problem in getting user comments permalinks | wordpress |
How can I show user's post counts of one's (Author) own in the admin post list (edit.php) instead of all post count of the system? like published (10), Draft (5) ... of his own or logedin user. Thanks in advance. | Have a look here for the solution (code needs optimizing, but it works): stackexchange-url ("Help to condense/optimize some working code") | Showing Post Counts of One's (Author) Own in the admin post list | wordpress |
I'm making a website for a student activity and have a wordpress page for each member under a common parent group. Each page contains some member info (currently unstructured) and a profile picture. I would like to list all these members under a member page with perhaps a grid of profile pictures and names. Is there a ... | You might consider create a stackexchange-url ("custom post type") <code> 'person' </code> to mirror your user and then you'll be able to create member pages by creating a <code> single-person.php </code> theme template file. This answer provides code for doing that: Commenting in user profile page? | Wordpress for a club website -- Members page | wordpress |
I think I'm on the right track with what I need to do, at least for doing one of the ways it could be done. I'm not really sure though, I could be way off for all I know. This is part of the code I needed help with last night for resizing the uploaded image files, but now I am trying to figure out how to use the wp_del... | I have finally figured out how to do it, and it now works 100%!! Plus it uses the admin-ajax.php so clicking the Remove link there is an ajax request sent to the function that does the deleting of the attachment and returns the message saying it has been deleted. Here's the code for my solution, first is the html for t... | How to delete post attachments when jQuery is used with a click event on the delete link | wordpress |
I have a all my custom post types list together in blog format. What I'm trying to do is echo the post type name on each post. I tried this: <code> get_post_type_object('post'); echo $obj->labels->singular_name; </code> But it just displayed "Post" for everything instead of the custom post type name | If you are within The Loop, try: <code> $post_type = get_post_type( $post->ID ); echo $post_type; </code> Does this work for you? | Echo current custom post type | wordpress |
Somebody knows some trick in Add new Post to: Disable the upload of audio, video and other filetypes. Only accept the upload of an image (jpg, png, gif). Limit the upload of each Post to only One image (no more than one). Thanks in advance. | Hi José Pablo Orozco Marín: I was about to give up thinking that it wasn't possible or at least easy and then I stumbled onto the <code> wp_handle_upload_prefilter </code> filter which gives you exactly what you asked for! Here's the code: <code> add_filter('wp_handle_upload_prefilter', 'yoursite_wp_handle_upload_prefi... | Limit image upload to one and disable audio, video and other document file types to upload | wordpress |
I've already read what I can on a couple of sites and installed this plug-in: http://en.support.wordpress.com/code/posting-source-code/ http://alexgorbatchev.com/SyntaxHighlighter/ I'm missing how to make it work. Question 1: Do I have to type in the Visual window or the HTML window? Question 2: Does TinyMCE mess with ... | I use a similar plugin called WP Syntax, which works better, in my experience, so I'm going to answer for that one: Question 1: Do I have to type in the Visual window or the HTML window? In the HTML window. I prefer the <code> <pre lang="php"> </code> mode. Question 2: Does TinyMCE mess with this? Yes, it will ht... | Proper implementation/use of code/syntax highlighting | wordpress |
The purpose of this function is to simply wrap the first occurrence of the keyword in bold tags. I'm getting an error on the line marked below. Warning: DOMDocument::loadHTML() [domdocument.loadhtml]: error parsing attribute name in Entity, line: 4 in C:\xampplite\htdocs\testsite\wp-content\plugins\mylugin\test.php on ... | Hi @Scott B: Here's a modified version of what you have that resolves the error (although the XPath does not match; I'm not an XPath guru so can't help with the proper XPath syntax): <code> add_filter('wp_insert_post_data', 'my_bold_keyword', 10, 2 ); function my_bold_keyword( $data, $postarr ) { $myKeyword = "test 123... | Error passing post_content to function | wordpress |
I'm using PHP Exec to build a widget to show a list of upcoming events: <code> <?php function filter_whene($whene = '') { $whene .= " AND post_date >= '" . date('Y-m-d') . "' "; return $whene; } add_filter('posts_whene', 'filter_whene'); query_posts('cat=10&showposts=3&'); if ( have_posts() ) : while ( ha... | Hi @user2816: It would seem you are using that code in more than one widget? Try changing part of that code from these: <code> function filter_whene($whene = '') { $whene .= " AND post_date >= '" . date('Y-m-d') . "' "; return $whene; } add_filter('posts_whene', 'filter_whene'); </code> To this: <code> if (!function... | Get posts after today (upcoming events) | wordpress |
I'm working on the admin interface for a plugin I'm developing, and it involves collapsible layouts. I want the state of the layout to be remembered when the page is refreshed, so I'm trying to use some simple cookies to do so. In the interface, there are "collapse" buttons that collapse sections of the admin panel. Wh... | <code> if (getCookie($(this).attr("id")) == true) { </code> The above code will NEVER evaluate as true because cookie values are stored as strings. You are trying to store a boolean value, which is converted to a string when it is written to the cookie. When the browser reads the cookie value, it is also read as a stri... | Having trouble setting / modifying cookies | wordpress |
script type="text/javascript" is optional in HTML5 and all browsers (even old ones) recognise JavaScript without it. I am building an HTML5 site and want my script output to be consistent. However, scripts that use the WordPress enqueue function are printed with type="text/javascript". CSS is also printed with type="te... | This is hardcoded in <code> WP_Scripts->do_item() </code> method ( source ) and probably same for styles. So it cannot be filtered. As alternative you can extend class with modified version of this method and replace instance in global <code> $wp_scripts </code> variable. | Is there a filter for enqueue script to strip the type="text/javascript" property | wordpress |
Hey i tried using wordpress threaded comment feature but didn't work coz of custom theme. I have tried wp threaded comments plugin it works like a charm but unfortunately it has a conflict with the FV community news plugin, It shows a reply button on the community news area/widget. So i tried to do it manually... no lu... | Does it not work because theme is old or simply coded in incompatible way? There is this article in Codex that might be relevant - Migrating Plugins and Themes to 2.7/Enhanced Comment Display . Otherwise I'd take a look at some modern theme (like Twenty Ten) and see how is it properly coded for current WordPress versio... | Unable to thread comments because of custom comments.php file | wordpress |
It seems there must be a plugin for this, but I can't find it. I'd like to enable a jQuery slider in a post, using the images I've added to the gallery for that post. Does anyone know of a plugin? And if not, what would be the smartest way to implement this? Again it's important that it calls from that posts gallery - ... | I have written a couple tutorials on how to make a dynamic jQuery featured post slider with Wordpress, here is my best one which is the most popular post on my site, in case you're interested in trying it out. http://new2wp.com/pro/part-3-making-a-dynamic-wordpress-jquery-featured-post-slider-tutorial-finale/ | How to best create a jQuery Slider to display a native wordpress gallery? | wordpress |
Im trying to get the next and previous attachment by the user its currently displaying, this is what I have and it works great except it gets all of the attachments instead of just the ones from a specific user. <code> <p> <?php $attachment_size = apply_filters( 'twentyten_attachment_size', 900 ); echo wp_get_... | Hi @Jeremy Love: Good question! And it's a good question because there do not appear to be any hooks to allow you to write code to filtering by author. Sadly that means to copy their copy to make your own functions so you can make the required 1 line change (in this case, it's <code> 'post_author' => $post->post_... | Getattachment next and previous by author only | wordpress |
I have a custom post types called publications . I want to retrieve all the pages and publications . (I'm also filtering by taxonomy, but that's not what is creating the problem) <code> $args= array( 'post_type'=>array('publications', 'page') ); query_posts($args); </code> The above only returns pages, not publicati... | Hi @Bundarr: Testing the following basic example as a standalone file it looks like it works as expected and not as you are reporting: <code> <?php include '../wp-load.php'; header('Content-type: text/plain'); $q = new WP_Query(array( 'post_type'=>array('publications', 'page') 'posts_per_page' => -1, )); echo ... | Why can't I query more than 1 post type at a time? | wordpress |
I just started using vimpress . I can write posts by typing in Vim <code> :BlogNew </code> and send them by typing: <code> :BlogSend </code> I think a lot of Wordpress developers may be using the plugin. So my question is Is it possible to list and create custom post types with Vimpress? | simple and short. up to vimpress latest version 0.91 which was developed at 2007-07-13 no you can't. | Is it possible to list and create custom post types with Vimpress? | wordpress |
Hey guys, thanks in advance for your help. I've done my research and I'm a bit stumped with this... I'm building a Wordpress website for a client and it is going to have an e-store. I'm using wp-ecommerce. All of the store pages are loading with a javascript error: http://www.thecollectiveclothingco.com/products-page/t... | There are currently two copies of jQuery loaded on site: In header there is jQuery bundled with WordPress, likely requested by some plugin. In footer there is jQuery from Google CDN, likely added by your code? Obviously this is one too many. There are couple of ways to handle it: If you are fine with using bundled copy... | Wordpress Jquery Confliction with Plugin | wordpress |
Is it possible to two way sync a post type between multiple sites on a multisite install? For example if someone makes a change to an entry under post type "inventory" on Site A how can I make that reflect on Site B automatically and vice versa? I am thinking that there are two main possible way of doing this, neither ... | I don't know what you mean by sync users. Users are global in the network and can be assigned to any blogs. "both their public website and backend both use their own multisite blog. " This doesn't make sense. Can you clarify? | Two-way synchronizing of a post type among multisite blogs | wordpress |
I'm using the following code to retrieve posts: <code> <?php $featuredPosts = new WP_Query(); $featuredPosts->query('showposts=5&cat=3'); while ($featuredPosts->have_posts()) : $featuredPosts->the_post(); ?> <h1><a href="<?php the_permalink() ?>"><?php the_title(); ?></a>... | Hi @janoChen: Simple answer: no. What follows is what the PHP code for the function <code> wp_reset_query() </code> from <code> /wp-includes/query.php </code> in WordPRess v3.0.4 as well as the functions subsequently called. You can see that it's primarily about in modifying global variables. When you use <code> new WP... | Is it necessary to use wp_reset_query() in a WP_Query call? | wordpress |
I would like to try little web apps with WordPress. Just to accept some values for few fields and present the output using AJAX. What are all the necessary modifications on WordPress? So, far I've tried some plugins like exec-php. But, I am in need of a better advice/suggestion. | Natively WordPress posts are subset of HTML (even more like semi-HTML - paragraph tags can be implied and added on output, but not stored). As result it really really doesn't like to store or process active code in post's content. This applies both to internal logic in PHP and front-end logic of post editor (it activel... | How to run JS, PHP and etc. inside WP post? | wordpress |
I want to add a slide side ways jquery to my website, I tried the following code, but seems not to be working Jquery code:- <code> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js" type="text/javascript"></script> <script src="http://tab-slide-out.googlecode.com/files/jquery.tab... | I think the main problem is that you need to use a no-conflict wrapper when calling tab slideout. However, rather then simply point out the problem i'm going to cover some things you should be doing to make this script work "The WordPress Way" ..(ie. using an enqueue and hooking onto an appropriate hook to make that en... | Jquery integration with my theme | wordpress |
I have finally!! got this thing I've tried about 12 times to make and 12 different ways, but finally got it to work,... sort of. I made a custom metabox for uploading and attaching images to posts, and it doesn't require you to use the horrible thickbox media uploader built into WP. I hate that thing. No, what I've don... | Hi @jaredwilli: Dude! Valiant effort, and nice work. All-in-all it could be a great addition to WordPress. You were so close, but you had somewhere between 5 and 10 little failed assumptions or code that looks like you started it but didn't get back to it because it wasn't working. I reworked your function only as much... | How does WP media uploader create the 3 different sized images, and how can I duplicate it | wordpress |
Assuming I know the image attachment ID, how can I get the post permalink to which is attached (if any) ? | Roughly this: <code> $parent = get_post_field( 'post_parent', $id); $link = get_permalink($parent); </code> | Get the post attached to a image attachment | wordpress |
I want to use <code> next_post_link </code> and <code> prev_post_link </code> to return only the next post in my custom taxonomy of a custom post type. I have a custom post type called "work_posts" which has the taxonomy "work_categories" assigned. The category I want to show is called 'all'. I looked up <code> get_adj... | Take a look at http://wordpress.org/extend/plugins/ambrosite-nextprevious-post-link-plus/ Its a plugin that adds extra missing functionality to next_post_link and prev_post_link functions. | next_post_link on custom taxonomy | wordpress |
Right now, I'm using <code> get_posts </code> to retrieve cusstom posts types with a custom taxonomy assigned to it in order to generate static content like this: <code> <?php /** * Template Name: Front Page * @package WordPress * @subpackage Prominent * @since Prominent 1.0 */ get_header(); ?> <div class="sha... | Hi @janoChen: If you have a choice, go with <code> WP_Query </code> . Both of the other functions ( <code> query_posts() </code> and <code> get_posts() </code> ) call <code> WP_Query </code> indirectly. The former is designed to allow you to modify the main query after the standard query has already been run, for examp... | Is it better practice to use query_posts, WP_Query, or get_posts to create various custom loops within a Page? | wordpress |
What would cause this error: Fatal error: Class 'ZipArchive' not found in /home/test/dummyurl.com/wp-content/themes/mytheme/upload-zip.php on line 14 PHP Version is 5.3.1 Does WP have a built in function I should use instead? Like perhaps the "unzip_file" function line 525 of ./wp-admin/includes/file.php"? <code> funct... | It means your PHP installation doesn't have the Zip library . You can install it by recompiling PHP with the <code> --enable-zip </code> option, or install the PECL package . | Fatal error: Class 'ZipArchive' not found | wordpress |
i'm using wp_list_categories like so: <code> <?php //list terms in a given taxonomy using wp_list_categories (also useful as a widget if using a PHP Code plugin) $taxonomy = 'news_cat'; $orderby = 'name'; $show_count = 0; // 1 for yes, 0 for no $pad_counts = 0; // 1 for yes, 0 for no $hierarchical = 1; // 1 for yes,... | Hi @matt ryan: Simplest way to do what you want is to use PHP output buffering . I haven't tested it yet but this should work: <code> ob_start(); wp_list_categories( $args ); $html = ob_get_clean(); echo str_replace(get_bloginfo('wpurl'),'',$html); </code> UPDATE You could also using the <code> 'wp_list_categories' </c... | wordpress wp_list_categories | wordpress |
I don't know whats wrong going on with my website, this is the second redirection problem going on, Whenever I add a new post, After adding title, When I try to add the content, My own websites home-page appears next to the content box, in a red bordered box, and a page tries to load, this page keeps on loading, nothin... | As stackexchange-url ("t31os") said, first thing you should do is disable all plugins, see if wp-admin/post-new.php works fine then, and re-enable them one by one, see which one is causing trouble. I would start with the plugin to change the admin theme, since this is the closest one to the admin dashboard. | Add new post redirection | wordpress |
Say I have a custom post type called "Performers". This gets populated with different bands/performers. These posts have a featured image as well as custom fields (mp3 file, facebook link, myspace link, etc). I have another custom post type called "Events". When I create a new Event post, I would like the option to hav... | Currently the best way I know to handle that is the Posts 2 Posts plugin : http://wordpress.org/extend/plugins/posts-to-posts/ Here's an example showing how to set up the custom post types (if you already have them it's more for other's benefit who might be reading this) as well as the function call to <code> p2p_regis... | How to insert content from another Custom Post type into Post? | wordpress |
im trying to redirect the loggedin user to a page i created on the backend, i want to use my index to do so so, i added a <code> do_action </code> wrapped in an if statement <code> is_user_loggedin() </code> to call my function. here's the function: <code> function my_redirect() { global $bp; if ( $bp->current_compo... | I think what you're trying to do here is create a custom hook. You should just do this to make it work correctly: <code> <?php if ( is_user_logged_in() ) my_redirect(); ?> </code> There's no need to make it an action if you can use the function directly in your template. Actions are primarily used when you want t... | 2 small questions: How to redirect to a created page & show that pages title in wp, bp | wordpress |
I am currently using a plug-in called Wishlist member. It allows you to create membership levels in WordPress. I want to be able to display different content on a page depending on the membership level of the viewing user. Something like this - <code> <?php global $current_user; get_currentuserinfo(); if ($current_u... | there is a lot of discussion about this in wishlisMembers support forum but the developers over there ignore it. Any way try this: <code> // get the current user level from WP more important is global $user. $user = wp_get_current_user(); // Get user levels from WishlistMembers $levels = WLMAPI::GetUserLevels($user->... | Conditional Tags for Membership Levels when using Wishlist Member Plugin? | wordpress |
I've read several topics about this and different ppl have different views on the best practice. In terms of WP, how do I store data to DB the safest way? This is one insert I'm using now: <code> $result = $wpdb->insert($table_name , array( 'arena' => $galleryData['arena'], 'year' => substr($galleryData['seaso... | No the sanitization is already done. Well the mysql_real_escape_string is done, it's considered bad form to filter html on input. I personally think doing it on output kinda breaches DRY. If you did in WordPress I highly suspect somewhere else will do it again resulting in double html entities encoding. Also by the way... | What is the best way to sanitize data? | wordpress |
I am adding a meta box in the create post/page interface and I want to get the ID of the post being edited/created so I can dynamically display the value of the input field. From the wordpress codex http://codex.wordpress.org/Function_Reference/add_meta_box : <code> /* Prints the box content */ function myplugin_inner_... | Try <code> get_the_ID() </code> or <code> global $post; $post->ID </code> . | Get post ID from the Create post/page admin interface? | wordpress |
I want to know the correct way to load existing scripts in <code> wp-includes/js/jquery/ </code> Example I want to load <code> jQuery UI Tabs </code> What I have done for now <code> function sample_exists_code() { echo '<script type="text/javascript" src="'. CONSTANTS_JS .'/jquery.js"></script>'."\n"; echo ... | Hi @haha: <code> 'admin_init' </code> is definitely an\ workable way to load scripts but you might also want to take a look at this blog post and consider using the <code> "admin_print_scripts-{$page}" </code> hook instead which can allow you to only load on your page when you need it and not burden the other admin pag... | How to load default scripts included with WordPress correctly? | wordpress |
My question is how do I customize the default WordPress login and register page without editing WP's core files. I'm thinking more along the lines of a functions.php code. Can anyone help me out by finding a tutorial or something? Remember, I don't want to edit the WP core files. Thanks! | Here's my functions.php that you can copy the functions. My CSS is admittedly thrown together fast and could be neater. I'm in a hurried launch phase right now. But you can use the functions. The first adds css to your head of the login page to override the styles. The later two functions change the url and title attri... | How to customize wordpress login/register pages? | wordpress |
Based on this stackexchange-url ("post"), I'm hoping to create good categories now, that I won't have to change much later. Can you change a category name later, without having to go back and re-categorize all articles? Using the category "Information Technology" as a challenging example, would you call it: a. IT b. I.... | 1.: Yes (Slugs differ then, but no need for you to re-categorize each post) 2.: As you wrote: "Information Technology". As a rule of thumb, Category Names should be between 2 and 26 characters, the actual length depends on your site and your needs as there is no hard nor soft limit to category length and there is no "i... | Length of Category Names | wordpress |
How do I customize how my theme shows up in the list of available themes in the Admin console, under the "Appearance" -> "Themes" section. I need to change stuff like the theme name, author, and description. | Hi @Farinha: You need to create a <code> screenshot.png </code> and store it in the theme directory. See the directory for the TwentyTen theme: That of course looks like this: UPDATE To update the theme name, author, and description you modify the header of the style.css file. Take the one from TwentyTen as an example;... | Customize how a Wordpress theme looks like in the Theme Selector | wordpress |
I am in trouble, I need help. Whenever I edit any theme code in my dashboard/appearance/editor and try to save it, the file is not saved and it automatically directs me to the homepage. I don't know why is this happening. I cleared the cache through the W3-Total Cache plugin. A few hours before I did the same process, ... | I experienced an issue similar to this several months ago. I was using a plugin to kill query strings from the URL for SEO purposes. Long story short the plugin was killing search pages and admin pages as well. As Chris_O mentioned the redirection plugin I encountered a similar redirection issue when track modify posts... | Redirecting to home-page when saving any edited code | wordpress |
I try to change the main loop in such a way: I have a meta key for displaying featured items, that should be shown only on the home page of the a blog. I pull them in a code separate from the main loop, something like - <code> $leading = get_posts('showposts=5&meta_key=_pull_leading3&meta_value=on'); foreach ($... | I think this will do what you want. But I still wonder whether sticky posts wouldn't have been better... <code> if (is_home() && $paged == '0') { //$paged value is 0 on 1st page and not 1 ! query_posts('posts_per_page=7&paged='.$paged.'&meta_key=_pull_leading3&meta_value=off'); } else { // recreate ... | Modify main loop query for paged and meta key | wordpress |
I'm adding this filter when the condition is true. Can I add another function on the same filter when the 2nd condition is true or will the last one cancel out the previous one? <code> if(get_option('my_nofollow_flag'){ add_filter('wp_insert_post_data', 'save_add_nofollow' ); } if(get_option('my_second_option'){ add_fi... | Hi @Scott B: Absolutely. That's part of the design of the system, you can add as many as you need (other plugins do.) The only issue is if you might need to address which one runs first and that's when you may have to set the priority. In the below example the third one would run first and the second one would run last... | add_filter multiple times with different addon functions? | wordpress |
How can i change my front end menu depending on if the user is logged in or not? For Example: View 1: user is not logged in menu is : home , about us, testimonials View 2: user is logged in menu is : dashboard, my profile, support Thanks in advance. | Hi @rxn: Define two menus and serve them based on if they are logged in or not which you can do in your theme's <code> functions.php </code> file: <code> if (is_user_logged_in()){ wp_nav_menu( array( 'menu' => 'Logged In Menu', 'container_class' => 'logged-in-menu', 'theme_location' => 'logged-in' )); } else {... | change front end menu depending on user login | wordpress |
Researching various shopping cart solutions for a WordPress based eCommerce website. Based on research, it seems that two plugins stand out: shopplugin.net phpurchase.com Can anyone share their experiences with these or offer some good alternatives? The list of requirements is too long to include here, but the store wi... | WooCommerce all the way: http://www.woothemes.com/woocommerce/ | Shopping Cart Integration -- Experiences with Popular eCommerce Solutions | wordpress |
I have been trying to work out just where in the massive jungle of Wordpress include classes the usermeta table is joined onto the users table and if so, how does it work? The one confusing thing about the usermeta table to me is that it is using key/value fields for the database fields and not actual values like first... | Hi @Dwayne: I'm not 100% what you are asking, it seems like several questions? But here goes: <code> $meta_value = get_user_meta($user_id, $key, $single); </code> For example: <code> $first_name = get_user_meta($user_id, 'first_name', true); </code> As for adding hooks I think this answer might be what you are looking ... | In what part of the Wordpress core does the users table and usermeta table get joined? | wordpress |
Is WordPress adding anchor tags automatically? I'm really puzzled, this is the code: home.php <code> <div class="post-bottom"> <?php if ( count( get_the_category() ) ) : ?> <span class="cat-links"> <?php printf( __( 'Posted in %2$s', 'twentyten' ), 'entry-utility-prep entry-utility-prep-cat-links',... | Hi @janoChen: The function <code> get_the_category_list() </code> in <code> /wp-includes/category-template.php </code> adds the anchors that you are asking about. You can find it on line 175 in WordPress v3.0.4. I also notice that you posted what looks like an object inspector from Chrome or Safari. Sometimes when the ... | Anchor tag in the entry-utility section ( the Posted in...part) appears from nowhere? | wordpress |
I found a code scrap on the internet which uses <code> if($user_id) { </code> instead of <code> if ( is_user_logged_in() ) { </code> to check if the user is logged in. I would assume that the first would be slightly faster because it's not running a function, but can anyone verify that this would always work? | Well it wouldn't always work unless you global $user_id. is_user_logged_in will however work without that extra line of code. The speed improvement is most likely so small it's less than the speed improvement between single and double quotes and not even worth thinking about. Also $user_id variable may disappear in a n... | $user_id vs. is_user_logged_in() | wordpress |
I'm going back and reworking categories and tags on some older posts. So I'm going back in time, to say for example page 4 of my posts. I know there are search filters, which might help, but let's follow through with this scenario. I'm on page 4, and update the first post on that page. Now, is there a fast way to get b... | Open post to edit in new browser tab/window so that page X remains in original tab/window? | How to get back to same page of post-list - after updating a post | wordpress |
I'm using the_time function to print the current date on my site. The problem is, that it's returning post or page creation times on pages other than the front page. Can I force it to print the current time on all views? | the_time() function is a WordPress built-in function to display the time of the post creation. So if you want to display the current date and time you need to use php function date something like this: <code> <?php // Assuming today is March 10th, 2001, 5:16:18 pm, and that we are in the // Mountain Standard Time (M... | How to call the_time current? | wordpress |
I am trying to hook 'wpmu_new_blog' in a plugin so I can copy the widget settings from one blog to the new blog that is being created. Does anyone know if there are WordPress functions to accomplish this, or should I just use straight SQL? Thanks, Dave | I don't think there is anything specifically for this. You might want to look at the plugin code to find calls to <code> get_option() </code> and see what keys they are using, then browse the DB table <code> wp_options </code> with phpMyAdmin (or whatever) and grab the associated values. Without specific support from t... | Copy widget settings from one blog to another | wordpress |
I downloaded various themes on net and I found on <code> functions.php </code> they write something like this Example to remove inline comment style. <code> function demo_remove_recent_comments_style() { add_filter( 'show_recent_comments_widget_style', '__return_false' ); } add_action( 'widgets_init', 'demo_remove_rece... | It is not always required technically but it is good practice to follow for multiple reasons: Code is more organized by keeping hook-related stuff together The more precise conditions when it runs - the better for performance It is easier to unhook function, that performs multiple add _, then unhook each add _ individu... | It's okay if I do not write add_action() | wordpress |
I just placed this in my <code> functions.php </code> (I'm using Wordpress 3.0.4): <code> function new_excerpt_more($more) { global $post; return '<a href="'. get_permalink($post->ID) . '">Read the Rest...</a>'; } add_filter('excerpt_more', 'new_excerpt_more'); </code> But my post is still displaying <co... | Hi @janoChen: Your theme (or a plugin) is overriding your filter. Try increasing the priority like this: <code> add_filter('excerpt_more', 'new_excerpt_more',11); </code> Or like this: <code> add_filter('excerpt_more', 'new_excerpt_more',20); </code> And if that doesn't work try: <code> add_filter('excerpt_more', 'new_... | I can't modify the 'Continue reading...' link of the_excerpt | wordpress |
Wordpress states the following: An excerpt is a condensed description of your blog post and refers to the summary entered in the Excerpt field of the Administration > Posts > Add New SubPanel. The excerpt is used to describe your post in RSS feeds and is typically used in displaying search results. The excerpt is somet... | Hi @janoChen: Are you sure that code it running and not some other code? I just traced through the code and the only way it's going to do that is if you have a plugin or code in your theme that is hooking one of the following hooks: <code> 'the_excerpt' </code> , <code> 'get_the_excerpt' </code> , <code> 'wp_trim_excer... | the_excerpt is not limiting my post page to 55 words? | wordpress |
I search on this site and found many stackexchange-url ("answers") for this question. Most of them is not working on my theme. Here is a one solution I found and it's working according to my need. <code> function wp_nav_menu_no_ul() { $options = array( 'echo' => false, 'container' => false, 'theme_location' =>... | The function wp_nav_menu takes an argument of fallback_cb which is the name of the function to run if the menu doesn't exist. so change you code to something like this: <code> function wp_nav_menu_no_ul() { $options = array( 'echo' => false, 'container' => false, 'theme_location' => 'primary', 'fallback_cb'=&g... | How do I remove UL on wp_nav_menu? | wordpress |
Hello I would like to know if there is a way to pull the contents of comments on a post to a separate page from wordpress. currently this is what i have, i'd like to replace with a function to pull the comments instead of pulling the link to the comments. <code> <?php // Include Wordpress define('WP_USE_THEMES', fal... | add to your loop and replace it with the the_permalink() function something like this: <code> <?php // Include Wordpress define('WP_USE_THEMES', false); require('./blog/wp-load.php'); ?> <div> <p style="font-size:18px;color:white;font-wieght:700;">Recently Asked Questions</p> <?php query_post... | how to pull wordpress post comments to a external page | wordpress |
I want to extract the first oEmbed url inserted on the content of a post in order to put in a meta tag from the header, or elsewhere as a way to style it differently from the rest of the content. | I assume that you're only interested in the first URL that actually succeeds at discovering actual oembed data. The oembed system processes all links it finds, but not every link will have oembed going for it, obviously. The filter you'll want to use is embed_oembed_html and it gets the HTML cached by oembed, the url, ... | Extract the first oembed url inserted on the content of a post | wordpress |
Is it possible to insert links in Wordpress's wysiwyg editor that will convert to pretty permalinks when enabled? i.e. the links would be this without pretty permalinks: /?p=13 But with permalinks on, it would become this: /mypagename/ I'm thinking I'd have to use a shortcode to do that right? Something that would use ... | Here is example of simple shortcode that will take ID as argument and echo permalink for it: <code> function link_from_id($atts) { if( isset($atts['id']) ) return get_permalink( (int)$atts['id'] ); } add_shortcode('link', 'link_from_id'); </code> Usage: <code> [link id=1] </code> PS by the way non-pretty permalinks wil... | Adding page links to content that automatically convert to pretty permalinks? | wordpress |
This seems like it should be easy to do, but I've not been able to find or work out a solution. I'm using the Starkers theme and Wordpress 3.0.4, and my site auto-generates its navigation as per normal. I would like however the navigation to only show the top level pages , i.e. not display links to any pages that are c... | Had you tried <code> depth </code> argument (see <code> wp_nav_menu() </code> documentation)? Also do I understand right that you do not setup menu manually and let theme generate it with custom callback that you have in your code? Update Same answer - try <code> depth </code> argument, only this time in <code> wp_list... | Only show top-level links in site navigation | wordpress |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.