question stringlengths 0 34.8k | answer stringlengths 0 28.3k | title stringlengths 7 150 | forum_tag stringclasses 12
values |
|---|---|---|---|
I am looking for a widget that a user can choose a Custom POst Type Term from a list. As an example I have a Custom Post Type called events and it has multiple categories. I want the user to be able to choose to show only posts from a certain category. Does anyone know of one or know how I can make this please? | I have build, some time before a widget, Also you can set the number of posts, the category and the order! <code> <?php /****** Widget ******/ class Artdev_Category_Posts extends WP_Widget { function Artdev_Category_Posts() { $widget_ops = array('description' => 'Add Selected Category Posts to the Sidebar' ); par... | Is there a widget that can display a certain Custom Post Type Terms? | wordpress |
I am creating a member only wordpress site that will restrict the number of custom posts a user can publish (Custom post type = contacts) based on their role. I will have 4 roles: Role 1 = 25 posts; Role 2 = 150 posts; Role 3 = 300 posts; Role 4 = unlimited posts Is this possible to do with WP hooks? | I found this plugin Bainternet Posts Creation Limits witch let you add how meny post a user, role or group can create. The plugin description says: Main Feature: Limit number of any post type creation. Select Post Status to count. (NEW) Limit number of any post type creation by user Role. (NEW) Limit number of any post... | How to limit the number of posts a user can publish based on user type | wordpress |
Hi I am having a problem, I updated my wordpress site to version 3.3 and the site itself seems to be working fine except I cant log into the dashboard anymore. When I login using my admin details it keeps re-directing me to /forums/profile page for admin user. Please can anyone help me out or has anyone came across thi... | Okay, seems like the user permissions got changed. Did you have a plugin that manages user roles? Anyhow, I'm assuming that you have database access. Check the role that has been assigned to the user. You may have to change this manually to an administrator by editing the database. Hope this helps. :) | Can't access Dashboard after Worpress 3.3 Update? | wordpress |
Looking to build a very data-heavy content site and not sure if what I'm looking to do can be accomplished in WordPress (my preference) or even in Drupal for that matter. The problem isn't the content, which I assume Custom Post Types (or maybe Pods??) could do. It's the relationships between the content. Basically wan... | I would go with WordPress for the simple reason that it takes less time to create custom websites (your in a WordPress Support site did you think you would get a different answer?). It sounds like you need to read up on custom post types and taxonomies. I don't see why the requirements you've mentioned couldn't be hand... | WordPress or Drupal for data-heavy content site | wordpress |
I've noticed a problem I have with images in my posts: they seem to go unnoticed to my CSS. For example, I have a span tag that is adding a 100px margin to the top of itself under the last paragraph in each post. But when an image is present the span tag seems to ignore the image as part of the paragraph content. There... | It's because you've floated your image on line 745 of your CSS. You've cleared the span, but the margin property still won't if there's a floated element above... Change the margin to padding, that should fix it.. | Why doesn't WP recognize images in posts like other content? | wordpress |
Issue? Whenever I use the term 'CSS' in a post title, the rest of the title (after the term 'CSS'), is inserted at the top of the single post page. What steps will reproduce the problem? 1. Create a new post. 2. Type 'CSS' somewhere in the post title. 3. Preview/publish the post. What is the expected output? What do yo... | Disable all plugins. One of them puts all words with capital letters in a <code> <span class="caps"> </code> container. In <code> <meta property="og:title" content="test <span class="caps">CSS</span> title" /> </code> … this closes the <code> <head> </code> section automatically because ou... | Cannot use 'CSS' in post title | wordpress |
When I go to a tag archive ( http://themeforward.com/demo2/tag/n/ for example) ALL the posts on my blog are being displayed, not just the posts with that tag - and I'd like to fix this. Here's my tag map, click any tag and ALL posts are being pulled http://themeforward.com/demo2/templates/547-2/ Here is how I am queryi... | create a tag.php template from a copy of archive.php or category.php, and remove the 'query_posts' line from the code. | Query Posts Incorrectly Displaying Tags Archives | wordpress |
I'm trying to install Jetpack after a successful install, but Jeckpack throws an error about site not being publicly accessible: site_inaccessible Error Details: The Jetpack server was unable to communicate with your site [IXR -32300: transport error: http_request_failed Operation timed out after 15001 milliseconds wit... | You may not have enough processes running. To test, try creating a file sleeper.php: <code> <?php sleep(5); echo "Working fine\n"; </code> And then run this from the cli: <code> curl -m 6 http://example.com/sleeper.php & curl -m 6 http://example.com/sleeper.php & wait </code> If there is only one process it ... | Cannot activate Jetpack on my server | wordpress |
Using the following code I experienced some problems: Login works but every link in the dashboard I will click will follow into the 404 not found page. It seems that there won't be a working session created? <code> $username="admin"; $password="admin"; $url="http://www.yourdomain.com/"; $cookie="cookie.txt"; $postdata ... | Not sure its a session issue, i think it has to do with the fact that WordPress Dashboard uses relative links. A quick hackish fix would be to add <code> curl_setopt($ch,CURL_COOKIEFILE, ''); // Enables session support </code> Then, add this after closing the curl handler redirect to the actual dashbard location: <code... | Creating login session via CURL | wordpress |
I am using my own child theme for twentyeleven, and I've made some changes to some plugin's css classes in my child style.css. The problem I'm having is that if I add a new css attribute to a class from the plugin's css, then it will make the change. But, if the attribute is already declared in the plugin's css, it rel... | I suggest that you use specificity to do this. Right now both rules are of equal value. What div holds the div "product?" If the Div is called "wrapper" your code could look like this: <code> body div.product div.images img { ...... } </code> | Why won't child theme's style.css override plugin's css | wordpress |
Does anyone know how to exclude the breadcrumb from appearing on the 'home' page only using this plugin? I have currently got it set up in the header template and so it is appearing on every page. | Opne you header.php file and look for something like this: <code> <div class="breadcrumbs"> <?php if(function_exists('bcn_display')) { bcn_display(); } ?> </div> </code> then before the call for <code> bcn_display(); </code> make sure you are not on the home page so basicaly replace <code> bcn_display... | Breadcrumb NavXT plugin - exclude 'home' page | wordpress |
I am trying to get my head around the permalink structures on Wordpress sites, and I'm a bit stuck with what I'm trying to achieve: My current permalink structure: /%category%/%postname%/ I have a custom-post type called 'city', and I want to create a structure like below: mydomain.com/asia/china/beijing So just to exp... | You don’t need these two taxonomies. Just make your custom post type for places hierarchical and set countries and continents as parents. WordPress will build your permalinks then exactly as you want it. After you’ve created the first post you get a selector for page parents from which you can choose: | Including two taxonomies in a permalink structure | wordpress |
My wordpress Website Version is 2.8.1,This is the Custom wordpress website done by 2 years ago.[Link Removed... i got Solution][1]Now Search functionality is not working(It was working well earlier.) My Client told Don't Upgrade the Version . so here we need to replace the old search function with newer Search function... | OK, just to clarify your question. Your problem is with the search form not appearing in the top right corner? All I see there is a search image, but no input field. The search functionality does work on your site, eg: http://lunetours.com/?s=destination but something's not configured properly there either, as it's not... | wordpress Search function is not working | wordpress |
logged in as admin and trying to code that deletes posts to delete an attachment. got, <code> <?php if (current_user_can('edit_post', $attachment->ID)) echo "<a href='" . wp_nonce_url("/wp-admin/post.php?action=delete&amp;post=".$attachment->ID."", 'delete-post_' . $attachment->ID) . "'>Delete<... | ended up using ajax in the end... html; <code> <a class="remImage" name="<?php echo $attachment->ID; ?>" href="#"><?php _e('delete');?></a> <input type="hidden" id="att_remove" name="att_remove[]" value="<?php echo $attachment->ID; ?>" /> <input type="hidden" name="nonce" id... | delete attachment from front end | wordpress |
Curiously, Akismet is deleting old spam comments after a period of time (I'm guessing within a week). This box is NOT checked: Auto-delete spam submitted on posts more than a month old. I've sent a message to Akismet support more than a week ago but I've not yet received a reply. I do not want Akismet to delete anythin... | Firstly, there is no setting for not deleting spam comments. My confusion was caused by ambiguous wording on the Akismet configuration page... Auto-delete spam submitted on posts more than a month old. "more than a month old" is referring to "posts" that are more than a month old, not "spam submitted on posts" that are... | Akismet plugin is deleting spam despite preferences | wordpress |
I would like to display a custom 3.0 menu in my sidebar. I want the list to be in order of name, and the list to be sequential down the list of the left column and flow down, then into the right column. I currently am using css and floating the li's but the problem is the list goes back and forth from left to right col... | You'll need to register your own custom walker, but it's pretty simple as you only need to have one function( <code> start_el </code> ) inside the custom walker. We'll have to add the code from the thread you referenced to work out how many items there are, then work out what half is and end the current list when that ... | How to display 2 equal columns of li based on the count of items in wp_nav_menu divided by 2? | wordpress |
Does anyone have a tutorial on how to implement the new Tooltips API into a theme or plugin? I'm eager to tap into this to help first time users of my theme and plugins. From mashable'e excellent intro to 3.3 ... New Tooltips This may seem a bit annoying to more experienced users, but it can prove quite useful for most... | I can't come up with good quote, but as far as I understand from chatter - pointers are not considered public (available for use outside core) for version 3.3 So essentially there is no API to use yet. | WP 3.3 Tooltips API? | wordpress |
What hotel reservation plugins for Wordpress would you recommend for a Small hotel that has not more than 25 rooms? It needs to display room availability and can accept payment online. | I would suggest this plugin: http://wordpress.org/extend/plugins/booking/ There is a free version and a few very nicely featured paid upgrade services depending on your needs on their website. | Hotel reservation plugin you would recommend | wordpress |
I am trying to set a cookie on click via <code> setcookie('mycookie', 1, time()+60*60*24; </code> but I can not seem to get it working . If i click the button - when I check my cookies, it is not there . | Cookies are set on the session BEFORE the page starts to load. Therefor - This function will set the cookie for the NEXT time the page is requested. you can not (as far as I know ) set a cookie onclick without any javascript help, becasue when at the time the page is rendered (and your click button) - all the cookies a... | Wordpress cookies | wordpress |
Up until today's update, the code below has worked flawlessly to add a rich text editor control to the category description editor. Today it stopped working after updating to 3.3 Any clues what to tweak here? <code> <?php function my_editor_init() { if ( is_admin() || defined('DOING_AJAX') ) { if ( current_user_can(... | This changed in 3.3 Add this line below your my_head() function.... <code> wp_enqueue_style('editor-buttons'); </code> | WP 3.3 my rich text category editor toolbar is gone! | wordpress |
Are posts supposed to have parents? If so, what would that mean for a post to have a parent? Also, if there are some constraints to posts having parents, then where is that enforced? Not in the DB as I see it. | Out of the box, no, posts can't have parents. They can be assigned to categories, which can be organised hierarchically. Pages, however, can have parents and you can build a menu structure out of them by using that feature. As to where this is enforced: The parent of a post is stored in the column "post_parent" in "wp_... | Can posts have parents? | wordpress |
I'm making a custom theme. It's a highly specialized theme to make WordPress into like an application rather than a CMS system or blog. For instance, a Dental Office Scheduling System (with CMS and widget capabilities), as an example. Because my theme needs pretty URLs to work properly, something I really need is for t... | <code> function change_permalinks() { global $wp_rewrite; $wp_rewrite->set_permalink_structure('/%postname%/'); $wp_rewrite->flush_rules(); } add_action('init', 'change_permalinks'); </code> You may not need the action hook if you're sticking this in your theme activation function code. I also found that this onl... | How Do I Programmatically Force Custom Permalinks with My Theme? | wordpress |
I have a plugin that appears on the post and page editor screen and parses the editor content and reports back some info to the user. I need this same plugin to appear on the category editor screen and report against the "Description" field. Any ideas how it can be done? I'm hoping WP 3.3 may make it easier to implemen... | As far as i can tell no new hooks on this screen to handle metaboxes :( the only way i see is to use the <code> edit_category_form_fields </code> with a function that prints out the fields and save them using <code> edited_category </code> I've posted a tutorial about this a while a go <code> WordPress Category Extra F... | WP 3.3 makes it possible to add meta box to Category Editor Screen? | wordpress |
1) Take a look at this example <code> add_filter( "xxx_xxxxx", "blah_blah" ); function blah_blah(){ echo "filter added"; } </code> <code> xxx_xxxxx </code> can be anything like my_filter or it should be one of the name listed here . 2) Lets say i have some content in my theme outside <code> the_content </code> loop. Ex... | It depends whether you're trying to hook to an existing filter or hook to one you've made, looking at your second code sample suggests you're asking about making your own filter. And, yes you can add your own, something like this is valid inside your loop. <code> <?php echo apply_filters( 'my_blah_filter', '<p>... | Some questions regarding filter | wordpress |
I've been using the Co-Authors Plus plugin for assigning multiple authors to posts. The authors are very particular in the ordering of the names on the public-facing side of the website so I need the ability to arbitrarily order the authors. It turns out it's not that hard using a line of jQuery to make the Co-Author P... | Happy to take this question in the WordPress.org forums :) | Improving Co-Authors Plus Plugin | wordpress |
I must be doing something wrong here. I want to display the custom fields "pw_featured_note" & "pw_featured_price" Here is my code so far <code> function featured() { query_posts('post_type=property&posts_per_page=2'); if (have_posts()) : while (have_posts()) : the_post(); echo "<div class=\"singlefeatured g... | Try this code, I've removed <code> query_posts </code> and used <code> get_posts </code> instead because I'm not sure if <code> query_posts </code> will work in a shortcode and using <code> get_posts </code> is safer. <code> function featured() { $posts = get_posts(array('post_type' => 'property', 'posts_per_page' =... | Echo custom field value in shortcode function | wordpress |
In my menu i've got some menu items that i don't want to show to people who aren't logged in. One of these i only want to show to logged in users of a certain roles the other to everyone logged in. So one of them is called 'My Printer'. This should be visible to everyone that is logged in. The other is called 'Partners... | I've created the menu using the admin and placed that menu in a theme location. The menu items i want to hide are in this menu. Thanks for the 2 answers below, but neither achieve what i'm after. | Hide menu items for visitors and filter based on role | wordpress |
I've read many articles that says that we should not keep plugins that we don't use. Even if they are disabled, they use memory. functions.php instead of 10 plugins? What if i have 10 small plugins that each of them have a little function. Could I gain speed if moving the functions to the themes functions.php? If yes /... | I agree with Rarst that on the optimization "to-do" list , this is low-priority. ..however, As far as I know , this statement : This is myth and false Is not always true . Disabled plugins DO use memory in an un-direct way . and sometimes - depending on the quality and the quantity of plugins - a lot of it too. The rea... | Code in theme functions.php faster than with a plugin? | wordpress |
I am running this query which pulls all of the images attached to a particular post and outputs them into a slideshow (See example here - http://powers.deanelliott.me/property/1428-elm-street/ ) Is there a way that I can directly output a link (So that the larger image gets displayed in a lightbox) into this query as a... | I think you can use <code> the_attachment_link </code> or <code> wp_get_attachment_link </code> . http://codex.wordpress.org/Function_Reference/wp_get_attachment_link http://codex.wordpress.org/Function_Reference/the_attachment_link Example <code> the_attachment_link( $photo->ID, false, false, true ); </code> | Is there a way to add a link directly into this media query? | wordpress |
EDIT 12/19/2011 Thank you again Ijaas. Everything is working except for the order of the days. It is ordering the groups of days by the publish order. If an older post has a newer date in its meta_key then it is before a newer published post with an older meta_key. It sorts the events on one day properly but it does no... | sorry about the delay. Here is the condensed query that searchs for posts between today and 10 days into the future, then sorts and displays in them order. theoretically it should work but let me know if u get any errors. Update: 12/22/2012 - Fixed Sorting <code> <h1>Upcoming</h1> <?php $convertedtime = ... | Very Slow Page - How to Optimize # of Queries? | wordpress |
I know Amazon.com will pay affiliates (in some states, depending on tax laws) who send users to their website to buy a product. I've also seen some Wordpress sites that feature Amazon.com products with links that seem to be affilate links. Are there any good plugins for featuring affilate products from Amazon.com (or o... | Amazon product in a post plugin is the best i have tried so far. It can be used for all amazon regional websites like amazon.co.uk,amazon.fr etc | What plugins can I use to feature (affiliate) products on my blog (from Amazon.com)? | wordpress |
I've managed to add my own menu to the admin bar. I want the first menu item to link to my theme's options page. For example, is this 100% bulletproof or is there a direct method? <code> echo '<a href="'.get_admin_url().'admin.php?page=functions.php">Theme Options</a>'; </code> | Assuming the installation will never have a plugin register a page with that same name it should be safe, i'd suggest giving your registered page a uniquely prefixed name, and secondly if the page name refers to your theme's functions file wouldn't it then be calling the file directly(you shouldn't ever be calling the ... | How to link to theme options page from anywhere in admin? | wordpress |
I've just installed the Yoast SEO plugin and noticed that a new flyout menu was added to the admin bar once the plugin was activated. Anyone know is there is a tutorial or example on how this is done? | The action hook <code> admin_bar_menu </code> does the job. Here's what the comment in the core file says: It includes the action "admin_bar_menu" which should be used to hook in and add new menus to the admin bar. That way you can be sure that you are adding at most optimal point, right before the admin bar is rendere... | WP 3.3 How to Add Menu Items to the Admin Bar? | wordpress |
I have a class that will count the Lines of Code, Source Lines of Code, and the Code disk space used. I would like to save these values into the database so that these values can be calculated only when a new post is saved or updated instead of running the code on every page view So my question is, what is the best way... | Best way for storing them is Wordpress' Options Mechanism . ANd best way to trigger it when a post saved is using Wordpress save_post action . Example : <code> add_action( 'save_post', 'count' ); //Execute count() when a post saved/updated function count() { your codes here ... //save them to DB update_option("lines-of... | Update some database fields when post is saved | wordpress |
I have tried various versions of this here: <code> unset($wp_meta_boxes['dashboard']['normal']['high']['dashboard_wp_welcome_panel']); unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_wp_welcome_panel']); unset($wp_meta_boxes['dashboard']['normal']['core']['wp_welcome_panel']); unset($wp_meta_boxes['dashb... | If you're using multisite, there's a plugin you can network activate to disable the welcome panel on all new sites. It's aptly named " Hide Welcome Panel for Multisite ." If you just want to do this for a typical (single site) installation, it's also pretty easy. The welcome screen is shown for a user if a specific met... | 3.3: How do you hide the new dashboard welcome panel? | wordpress |
I don't like hoverIntent in the new flyout menus or admin bar; to me, it makes my page feel slow. What would be the Wordpress-friendly way to disable hoverIntent (or change its options) in the new Wordpress admin and toolbar? The only place I see hoverIntent in the Admin page source is here: <code> <script type='tex... | Where is Hover Intent attached to the menus in WordPress core? The following 2 files go about attaching hoverIntent as click handlers for the bar and menu respectively. Admin Bar The admin-bar.js file sets up Hover Intent on the top bar here on line 13 of admin-bar.js . Admin Menu The common.js file sets up Hover Inten... | How to disable hoverIntent in Wordpress 3.3 admin | wordpress |
For some reason, <code> get_option() </code> started to fail when returning binary results when I moved my website from localhost to the web server. I migrated my WordPress using an upload of the files on the FTP Everything else works perfectly however. Even the <code> wp-admin </code> works right: I can edit, post, et... | Found the problem. And A WORD OF WARNING to people MIGRATING their WordPress Installations . Read this to understand how get_option is going to start failing when <code> unserializing </code> binary data from the DB. What I did was to migrate my WordPress the hardcore way: copy all files to the web server, restore the ... | get_option() fails to return binary result | wordpress |
Ok quite a complex thing I'm trying to do here, and I'm a bit unsure how I will do it with wordpress, but I'm hoping some genius out there can help. I'm basically creating some comparison functionality, and I currently have two select boxes on the page. These select boxes will display the list of all posts within the c... | Don't really get what your main issue.. are you try to comparing two post types and display it in a page template? or are you try to comparing the current page with the selected post types? try this create a page template <code> <?php /* * Template Name: Compare */ ?> <?php get_header(); ?> <form id="cus... | Display custom-post type based on the Title matching the current selected value | wordpress |
This question is very similar to the one below however it requires a different solution. stackexchange-url ("Don't display html if custom field is empty") I'm using the plugin Related Posts Thumbnails but i'm using the template tag in my template file to display related products. <code> <?php get_related_posts_t... | <code> <?php global $related_posts_thumbnails; if ($related_posts_thumbnails->get_html()) { ?> <div id="relatedproducts"> <h1>Related Products</h1> <?php get_related_posts_thumbnails() ?> </div> <?php } ?> </code> A quick look at the <code> get_related_posts_thumbnails() </c... | Don't display html if function returns nothing | wordpress |
I see it is possible to use add_filter with the <code> body_class </code> function , but I'm needing to add one to the <code> get_body_class </code> function. How can I add a filter to a function that is not included in the list of already available filter hooks ? Thanks. | The <code> body_class() </code> function simply calls the <code> get_body_class() </code> and creates a HTML class string from it. <code> function body_class( $class = '' ) { echo 'class="' . join( ' ', get_body_class( $class ) ) . '"'; } </code> So, the <code> body_class </code> filter applies to both functions. | How to add a filter to the get_body_class function? | wordpress |
I need to add the following .htaccess code through a function <code> <IfModule mod_deflate.c> # Insert filters AddOutputFilterByType DEFLATE text/plain AddOutputFilterByType DEFLATE text/html AddOutputFilterByType DEFLATE text/xml AddOutputFilterByType DEFLATE text/css AddOutputFilterByType DEFLATE application/xm... | <code> /** * Inserts an array of strings into a file (.htaccess ), placing it between * BEGIN and END markers. Replaces existing marked info. Retains surrounding * data. Creates file if none exists. * * @param array|string $insertion * @return bool True on write success, false on failure. */ function add_htaccess($inse... | How to add .htaccess code through a function? | wordpress |
I received about 50 messages today with the similar message: WordPress Firewall has detected and blocked a potential attack! Web Page: domain.com/index.php?option=com_simpledownload&controller=../../../../../../../../../../../../../../../proc/self/environ%00 Warning: URL may contain dangerous content! Offending IP:... | This is very common, it is a malicious query string most likely (99% time) done by a bot, I think <code> option=com_simpledownload </code> is actually a Joomla plugin, so obviously it won't effect WordPress. You can see the detials here, http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2010-2122 | How much should I worry about these messages? | wordpress |
I want to remove /category/ base from the permalinks. I tried the solution stackexchange-url but if i try pasting this in functions.php, i get the 404 error. I also tried <code> RewriteRule ^category/(.+)$ /$1 [R=301,L] </code> by pasting in .htaccess , but still, i get 404 error. | To make things easier why don't you use this plugin -> WP No Category Base | Remove category from url | wordpress |
http://dev.freelanceu.net/mjl/miamischool/ that's my webpage that has a problem in the background, I don't even declared it as no-repeat but still the background was cut at the bottom. I'm confused because in the other page, it's not cut, like this one http://dev.freelanceu.net/mjl/miamischool/forms/ | Your background image repeats all right - but there's a white bar at the bottom of your image... http://dev.freelanceu.net/mjl/miamischool/wp-content/uploads/2011/12/MCCS_bg.jpg | image background is cut | wordpress |
My client would like the background & header colors to switch depending on terms within the custom taxonomy 'Grades'. These terms are kindergarten, first grade, second grade, etc... (all through twelfth grade) and are associated with a custom post type 'projects'. I've set up the menu so that each term in 'grades' ... | Like Justin Tadlock says in your referenced article , the body_class() provides the ability to add classes dependant on the type of term. Given that you indicate your php knowledge is still growing; this maybe the best solution. The codex provides a list of classes on a body_class enabled: http://codex.wordpress.org/Fu... | Changing stylesheet depending on custom taxonomy terms | wordpress |
I'm modifying the <code> install.php </code> (coping in from <code> upgrade.php </code> ) file to load default pages that get created with a new blog is registered. Im trying to find out how i can specify the page template that the new page will be assigned. is there anything like <code> page_template =>? </code> Iv... | I dont think there is anything like page_template=> but you can just specify the template like this: <code> update_post_meta($id, "_wp_page_template", "new_template.php"); </code> http://codex.wordpress.org/Function_Reference/update_post_meta or using your code above: <code> $wpdb->insert( $wpdb->postmeta, array(... | Set a default page template to load for multi-site | wordpress |
i need to remove the deafault TinyMCE editor from pages, i used this: <code> remove_post_type_support( 'page', 'editor' ); </code> But it removes also the media button that i need | You may want to have a look at the brand new wp_editor function in WP3.3, there's an option tiny_mce=true/false: http://codex.wordpress.org/Function_Reference/wp_editor | remove WYSIWYG editor but keep media button | wordpress |
Amongst technical devs, it's pretty straightforward to get everyone running their own local dev server, get TortoiseSVN running, and then commit changes periodically to the repository. We can then update the version of the test site on the shared server from this repo and everyone is happy. Except the designers who are... | If you don't want the designers to setup a revision control on each computer (this is the normal route), set up the designers on one cloud/remote server with SVN ( or even better a DVCS) that the dev teams can pull/push to. This technique can be combined for further control, this is done so team leads or senoir dev/des... | Setting up SVN for teamwork on WordPress custom theme development | wordpress |
I'm using multiple metabox panels in my write posts. IN my functions I'm registering multiple metaboxes: <code> $prefix = 'dbt_'; $meta_boxes = array(); $meta_boxes[] = array( 'id' => 'general_information', 'title' => 'General Information', 'pages' => array('post', 'page', 'link'), // multiple post types, acce... | You can add another simple foreach loop to check if you have any values first: <code> foreach ( $meta_boxes as $metabox ) { $has_value = false foreach ( $metabox['fields'] as $field ) { $meta = get_post_meta($post->ID, $field['id'], true); if(!isset($meta[0])){ $need_title = true; break; } } if ($has_value){ echo $m... | Display metabox title for custom fields with values | wordpress |
I could use some advise on how to structure my data for performance. I have a custom post type with a lot of custom meta data stored in the <code> wp_postmeta </code> table as a serialized array under one meta key for each post. Now, I need to get some posts from that post type, and filter them by the meta data I have ... | If you want to have more control over the filtering of your posts then separating the meta values into separate keys is the best option to go about it. Also what you could do is, only the values that would be required while filtering could be separated and the rest of them could go into a serialized array. | Filtering by Post Meta Custom Fields - Performance | wordpress |
I have custom post type called staff that has custom taxonomy called departments . I wanted the frontpage of the staff (archive-staff.php) to not show ALL the staff members, but actually the first department (lets say there are 3 departments.) My archive page starts like this: <code> global $wp_query; $args = array_mer... | This is what worked for me: <code> // Custom taxonomy $custom_taxonomy = 'department'; // Get the current department if (!$current_department = $wp_query->query_vars[$custom_taxonomy]) { $get_all_departments = get_terms($custom_taxonomy, array( 'number' => 1 )); $current_department = $get_all_departments[0]->s... | Show one of the taxonomies always as default | wordpress |
Is there a way, in an image gallery, to display what number the image is in the gallery in the image.php template? I'd like to incorporate this into my next / previous button area. For example, if I'm on the first image out of twenty it would say "1 of 20". | This should do it: <code> global $post; $ancestors = get_post_ancestors($post->ID); $photos = get_children(array( 'post_mime_type' => 'image', 'post_parent' => array_shift($ancestors), )); $index = 0; foreach($photos as $photo){ $index++; if($photo->ID === $post->ID) break; } printf('%d out of %d', $inde... | Gallery Image Numbers? | wordpress |
I am trying to synchronize development between a Windows user (WAMP) and a Mac user (Regular Apache). Windows User (me) Since I use IIS I need my port 80 so I have changed the ports on WAMP to :666. So the url to the Wordpress is http://localhost:666/projectname/ Mac user He has the site on a non-alias, just the path t... | You need to have 2 sets of settings one for if file_exists and one for else: <code> if ( file_exists( dirname( __FILE__ ) . '/local-config.php' ) ) { include( dirname( __FILE__ ) . '/local-config.php' ); define( 'WP_LOCAL_DEV', true ); } else { define('WP_HOME', 'http://localhost:666/projectname/'); define('WP_SITEURL'... | Different development environments (Mac & Windows) | wordpress |
This discussion relateds to plugins: stackexchange-url ("Symbolic Links on dev box with plugins and stylesheets") I was wondering if the same problem exists for symlinking a theme to many different wordpress installs. Example structure: domain/footheme/ <- theme resides here The following domains symlinks created he... | Due to project constraints i ended up just creating custom themes for both. If i was to approach this now i would probably manage it by creating a git repository and maintaining multiple git submodules | Symbolic Links for themes - linking one theme to many wordpress installs | wordpress |
I've been searching for a hook to change the order in which themes are displayed in the admin panel (i.e. wp-admin/themes.php) but so far haven't been successful. Is there an existing hook to do this, or another workaround so I can have a custom non-alphabetical ordering - i.e. have certain themes display before the re... | The <code> get_themes </code> function passes the available themes to the theme list table class and is hardcoded with a call to <code> asort </code> the array, with no filters available anywhere along the way that i can see. So in short, not possible at present due to an absence of hooks(at least as far as my observat... | Reordering themes in admin panel | wordpress |
I'm working on a plugin that generates a list of candidates as output. For each candidate there is a link (View Details) that once is clicked, a popup appears. I need to put a simple contact form into that popup, so when a visitor click on the candidate's link, the popup appear and the visitor can get into touch with t... | A) It's not a WP Question as long as it's not a specific plugin (link?). B) Do it with jQuery: <code> var str = <?php echo $user_id.'etc.'; ?>; var container = jQuery( '#contact_form_popup_id' ).html(); jQuery( container ).text( str ); </code> | how to insert a HTML form into a javascript popup? | wordpress |
I've been searching around for a fix to this and while I definitely have a much better understanding of my issue (thanks to similar queries posted by others) I am still not sure of the solution. I am writing a shortcode as follows: <code> function cup_bc_shortcode(){ $html = file_get_contents('/html/cup_bc_layout.php',... | The problem is that you are using <code> file_get_contents() </code> which only gets the content of the file (hence the name) if you need to render(evaluate and process the php file) then just use <code> include() </code> , but also if your cup_bc_layout.php file echo's out something then you should put the include ins... | Unable to process php via shortcode | wordpress |
I want to add the text to top of each category page. I am using a plugin http://wordpress.org/extend/plugins/categorycustomfields/ . With the help of this plugin, i am able to add extra field to my categories, but how can i display that. eg :- if i want to display category description, i used <code> <?php echo categ... | May I suggest using one plugin that I use for my sites ( I am a web-developer)? I Use Extra category content plugin ( http://www.greatwpplugins.com/extra-category-content/ ) if I want to put any kind of content (text, image, link, etc) before the post listing in a category. Just install the plugin, edit a category to a... | add text to the top of category page | wordpress |
I used custom post type, where 'thumbnail', 'medium' and 'large' sized not required. I need to disable this sizes and create function or plugin, where i can set, which image size is required for each custom post type. My first step is hooking of get_intermediate_image_sizes function from wp-includes/media.php. I have a... | I think the only solution you have at the moment is to disable all intermediate image sizes: <code> add_filter( 'intermediate_image_sizes', '__return_empty_array', 99 ); </code> And then manually generate them, depending on the post type, by hooking into 'wp_generate_attachment_metadata', where you do have access to th... | How to disable generation of default image sizes for some custom post types? | wordpress |
UPDATED CODE 12/12/2011 Here is the code in functions.php. I put the code for output in my events page. For now there has been on output. <code> <?php // Custom Meta Data for Events $meta_box['event'] = array( 'id' => 'event-meta-details', 'title' => 'Event Information', 'context' => 'normal', 'priority' =&... | You're already storing the venue, so you should be able to simply extract from an array front-side based on what a <code> get_post_meta </code> call returns. If i'm following you correctly still at this point, something along these lines should do the trick. <code> function get_related_event_data( $venue, $field = 'all... | Select Venue from dropdown list and reuse stored address information in meta_box | wordpress |
My pages have a sidebar with too many widgets, and it looks bad when the content is short and the sidebar is too long. I want to randomize the widgets I'm showing in the sidebar. Meaning I will add all the potential widgets to the sidebar, and it will randomly only display a few. I would also like some control over thi... | Here comes the workaround solution discussed in the comments: functions.php: <code> add_action( 'widgets_init', 'talfluxive_register_sidebars' ); function talfluxive_register_sidebars() { // register five random widget areas register_sidebars( 5, array( 'name' => 'Random Widget Area %d' ) ); // register two fixed wi... | How to place random widgets in the Wordpress sidebar? | wordpress |
I have a custom post type (called contacts). Since this post type is not working like a post, I don't want to show SAVE DRAFT, PREVIEW, Status, Visibility or Publish Date. The only options I want to show are PUBLISH & Move to Trash buttons. Is there a way to hide these other options? If not, how do I create a new P... | You can simply hide the options using CSS. This will add a display:none style to the misc and minor publishing actions on the post.php and post-new.php pages. It checks for a specific post type as well since all post types use these two files. <code> function hide_publishing_actions(){ $my_post_type = 'POST_TYPE'; glob... | How to HIDE everything in PUBLISH metabox except Move to Trash & PUBLISH button | wordpress |
I am migrating a static magazine site to wordpress. I would like to have a frontpage displaying multiple categories with a few posts in each, e.g "politics", "environment", "health" and "technology". On top of that I would like to have a "latest news" category. The posts displayed in the "latest news" category will als... | I wrote a class specifically for passing data between widgets classes using static variables and it will work for your use case as well. Grab the class here . The way you would use this is as follows for each custom loop: <code> $exclude_ids = IntermediaryData::get(); //Retrieve previous exclude IDs $args['post__not_in... | Magazine style frontpage with multiple categories/loops and no duplicate posts | wordpress |
I have the following code in my functions.php <code> if ( function_exists('register_sidebars') ){ $pages=get_pages(); foreach($pages as $page){ register_sidebar(array('name'=>$page->post_title, 'sort_column'=>'ID','sort_order'=>'ASC', 'id'=>$page->ID)); } } </code> It works beautifully to give me a si... | You need to wrap this in a function then add it to the widgets_init action. Also the register sidebar function does not have $arguments for sort_column or sort_order. I would also change the id to <code> 'sidebar-'.$page->ID </code> <code> add_action( 'widgets_init', 'prefix_register_sidebars' ); function prefix_reg... | Why is registering a sidebar for each page causing my sidebars to reset? | wordpress |
Toward the top of the edit.php screens there is a list that displays post statuses along with the post count. I believe this is generated by WP_Post_List_Table::get_views. For example <code> All (7) | Published (6) | Draft (1) </code> Unfortunately, those post counts do not respect filters. I am using <code> pre_get_po... | You might want to remove those counts and replace them with your own. <code> function insert_post_counts($views){ //Run your query to count posts //use wp_cache_set and wp_cache_get to optimize performance $edit_url = admin_url( 'edit.php' ); $views['all'] = 'All <a href="'.$edit_url.'">('.$all_count.')</a>... | WP_Post_List_Table::get_views - Have post counts account for filters? | wordpress |
I want to return ALL posts with <code> query_posts </code> . I tried setting <code> posts_per_page </code> to a really high number, but <code> query_posts </code> freaks out and doesn't return any posts. What is the correct way to query posts without a limit? <code> $args = array( 'post_type' => 'post', 'cat' => ... | -1 is your answer! Look for <code> posts_per_page </code> here. <code> $args = array( 'post_type' => 'post', 'cat' => '22,47,67', 'orderby' => 'name', 'order' => 'ASC', 'hide_empty' => 1, 'depth' => 1, 'posts_per_page' => -1 ); </code> | posts_per_page no limit | wordpress |
In a multisite, how can I get the ID of the owner of the current blog? I know how to get the current blogs Id using get_current_blog_id(), so given that ID, how would I fetch the ID of the owner of that blog? (there's just one owner per blog.) | I came up with this solution for a direct query, but I'd still like to know if there's a template tag I've missed. <code> $blog_id = get_current_blog_id(); $querystring = "SELECT `user_id` FROM `wp_usermeta` WHERE (meta_key LIKE 'primary_blog' AND meta_value LIKE $blog_id) LIMIT 1"; $blogownerid = $wpdb->get_var($qu... | the blog owner multisite | wordpress |
I'm creating a wordpress website for a client. MY AIM : Website will have links to products from various websites. Those links are actually affiliate links for website and services. Those link are needed to be converted into http://www.example.com/go/123 or something like that and when clicked they redirect to the actu... | I would let something like Google Analytics do the tracking for you with something like event tracking. Look into Yoast's Google Analytics plugin, it will let you do this fairly easily. Otherwise, something like Redirection would be good for creating redirects. And, of course, you can see how many times each was clicke... | Mask and Track Outbound Links | wordpress |
Wordpress 3.3 has deprecated the add_contextual_help() functions and it's filters, so in order to continue supporting 3.0 - 3.2.1 and also comply with 3.3, I have done the following: <code> global $wp_version; if ($wp_version >= '3.3') { // New method add_action("load-$admin_page", 'CrayonSettingsWP::help_screen'); ... | I don't see anything wrong with your approach. But I'm going to take a different track: don't support older versions of WP . The general impression I've gotten from the WP community is one of progress. By supporting the current version and forward you're helping to push the community towards using the most up to date v... | What is the best way to handle deprecated functions? | wordpress |
I'm trying to migrate from wordpress.com to self-hosted wordpress. These are some of the things I've done, but I'm not quite able to migrate successfully. Changed my Godaddy account DNS to wordpress Through Godaddy Web hosting connection, I installed wordpress application From wordpress.com I performed domain mapping *... | ** Edit ** Did you check your folder structure ? did you rename the wordpress folder ? have nested folders ? ** end edit ** @ allan z - that will not (always) work for an existing site , due to a multitude of reasons . the best way is to either follow these instructions here : Moving wordpress to another server or , do... | How to migrate from wordpress.com to self-hosted wordpress | wordpress |
How can I list posts as sub-items of authors? It should look like: <code> <ul> <li>Author</li> <ul> <li>Post1</li> <li>Post2</li> </ul> </li> </ul> </code> I have an array containing author data including <code> $author->ID </code> . My function looks... | This is a simpler solution, if you want a total control over the code and don't want to use a query. <code> $authors = get_users('role=author'); if(isset($authors) && !empty($authors)) { echo "<ul>"; foreach($authors as $author) { $posts = get_posts(array('author'=>$author->ID)); //if this author ha... | How can I list posts by author? | wordpress |
I'd like to get all pages that are direct children of HOME_ID. Per http://codex.wordpress.org/Function_Reference/get_pages#Parameters (see 'parent' parameter), I think this should be done with get_pages: <code> $top_pages = get_pages(array('parent' => HOME_ID, 'sort_column' => 'menu_order')); </code> but this ret... | Assuming that, by "HOME_ID", you are referring to the static Page used to display the Site Front Page , then you want to use <code> get_option( 'front_page' ) </code> to get the ID for this page: <code> <?php $menu_wp_query_args = array( 'post_type' => 'page', 'post_parent' => get_option( 'front_page' ), 'orde... | How to get pages of parent (non-recursive)? | wordpress |
I am working on a custom post type, I have removed all the standard wordpress form items and started from scratch with custom meta boxes, except the title field. In my situation, it is really important that some of the custom meta dropdown selections be selected. Is there an easy solution to make it where they must sel... | You can use jQuery as it already loaded on posts. The idea is to stop the form submit action. I have two html elements in my meta: <code> <select name="cars" class="required"> <option value="-1">Choose a car</option> <option value="volvo">volvo</option> <option value="saab">saab</... | Can you make a custom metabox field be required to save a new post? | wordpress |
wordpress by default writes the the date on posts, but how can I transform it to : "x" time ago ?? like 3 days ago, or 5 minutes ago ?? | <code> function k99_relative_time() { $post_date = get_the_time('U'); $delta = time() - $post_date; if ( $delta < 60 ) { echo 'Less than a minute ago'; } elseif ($delta > 60 && $delta < 120){ echo 'About a minute ago'; } elseif ($delta > 120 && $delta < (60*60)){ echo strval(round(($delta... | How can i put "posted x minutes ago on my posts? | wordpress |
I'm currently running a 365 photos project and it's based on a WordPress platform. Currently this is very helpful because I can upload the photos easily and manage comments and stuff. Because we are reaching the end of the year, I would like to "freeze" the blog. I mean, remove all the WordPress engine code and leave a... | Take a look at this Wordpress plugin WP Static HTML output This plugin produces a static HTML version of your wordpress install, incredibly useful for anyone who would like the publishing power of wordpress but whose webhost doesn't allow dynamic PHP driven sites - such as MobileMe. You can run your development site on... | Is it possible to "freeze" a WordPress blog? | wordpress |
BuddyPress has a function (bp_member_profile_data) that pulls profile data into a members loop which looks like this: <code> <?php bp_member_profile_data( 'field=Organization' ); bp_member_profile_data( 'field=Brief Biography' ); /*** * If you want to show specific profile fields here you can, * but it'll add an ext... | I think buddypress has a get* version of that function that returns the value instead of showing it on the screen. So just cut the returned string after a certain amount of characters, like 50: <code> $profile_bio = bp_get_member_profile_data( 'field=Brief Biography' ); if(strlen($profile_bio) > 50)) $profile_bio = ... | How to limit character length in BuddyPress function output | wordpress |
I am new to Wordpress theming and I would like to set up a Website that only has static content. Therefore would it make sense to disable posts and only use static pages? If so, is there an easy way to do that? | You can simply hide the posts menu by adding the following to your functions.php file: <code> function remove_posts_menu() { remove_menu_page('edit.php'); } add_action('admin_init', 'remove_posts_menu'); </code> | How to disable posts and use pages only | wordpress |
On a custom post type, I want to remove the filters that show up on /edit.php (where all of the posts are listed out). I have a custom taxonomy that shows up as a filter that I WANT to keep, but I want to REMOVE the 'Show all dates' and 'View all categories' filters. Any ideas? | This is a very similar question to the one you posted here: stackexchange-url ("How to HIDE everything in PUBLISH metabox except Move to Trash & PUBLISH button") Please check my answer. You would simply need to add the IDs of the elements you wish to hide. You can traverse the DOM to target the elements you need: <... | How to remove Filters from post admin page? | wordpress |
I'm using: <code> wp_localize_script( $handle, $namespace, $variables ); </code> to declare some variables before the initial AJAX call is made, but I imagine I can't do the same thing again within a callback function? I need to declare a newly created ID for use in another function, what's the best way? | The right way is to post the data back to the WordPress admin ajax url then in your PHP function access them using the <code> $_POST </code> variables. Example jQuery function that passed a category id back to wordpress: <code> function cat_edit_get() { jQuery( "#loading-animation").show(); var catID = jQuery("#cat :se... | How to declare a JS variable in an AJAX call | wordpress |
This should be a simple question. On websites like themeforest where you can buy themes others have built, when you preview the themes almost all the themes will have seperate pages for you to view seperate functionality For example if a theme has a portfolio, a blog with sidebars, a blog without sidebar, a blog with 2... | Paste the Following code to the top of your template: <code> <?php /* Template Name: Portfolio*/ ?> <!-- Do stuff here--> </code> This will make the Template selectable as a page template in the Backend :) | How to access custom pages | wordpress |
I am using media_sideload_image function in WordPress to upload images automatically from another location on the web. I want to add two more pieces of functionality. Add these images to a particular folder in my system, which I will specify once within the code. No thumbnails should be generated for these images, just... | Ad 1) Take a look at <code> wp_upload_dir </code> . Ad 2) Try <code> remove_theme_support( 'post-thumbnails' ); </code> | Specific folder and no thumbnail generation for media_sideload_image | wordpress |
Here is my situation. I plan to distribute a theme I am working on and it has a custom post type called <code> Code </code> and it has a custom taxonomy called <code> Languages </code> now I also use a custom metabox with a dropdown list of available languages, I need to somehow make the value that they choose in the s... | You should hook your actions to the <code> save_post </code> hook. It fires right after the post is created and the <code> $post_id </code> and other <code> $post </code> data variables are already available. Something like this should do the trick: <code> add_action( 'save_post', 'jason_code_save_post', 10, 2 ); funct... | How can I set taxonomy programmatically | wordpress |
It's working fine with Firefox, Chrome and IE <= 8. But with IE9 the header disappears. Anybody an idea how to fix this? It's about this theme: http://thethemefoundry.com/paperpunch/ and I'm using the free version | I loaded your test site and immediately noticed a couple of issues. Not 100% sure what exactly is causing the disappearing header, but here are some things to check: style-options.php Your main stylesheet is using <code> @import url("functions/stylesheets/style-options.php"); </code> to import a stylesheet. My guess is... | Header Paperpunch theme disappers with IE9 | wordpress |
I have this little code to insert posts via custom form: <code> $post = array( 'post_author' => 1, 'post_title' => 'my title, 'post_content' => 'my content', 'post_category' => array(3), 'post_type' => 'post', ); if ( $post_id = wp_insert_post( $post ) ){ echo 'post added!'; } </code> but now I need to i... | Check this wp_set_object_terms() . | working with term_relationships table | wordpress |
After modifying the code in my functions.php file to display a different logo on my login page, I'm getting a blank square instead. I've added a custom .png image (326x67) to my (child) theme's image folder, and the code I've added to <code> functions.php </code> is as follows: <code> function custom_loginlogo() { echo... | If you are using a child theme then maybe you should try the following code. Not necessary to put <code> !important </code> too unless some other plugin or code is overwriting it. <code> function custom_loginlogo() { echo '<style type="text/css"> h1 a { background-image: url('. get_stylesheet_directory_uri().'/im... | Changing Login Logo | wordpress |
I have an issue where I am adding custom meta to my products. Everything works fine until I update my product. This is before: This is after update: I am thinking it has something to with how it is pulling the data from the database. Anyone else have this problem before? Thanks in advance for your help. | This problem was caused by the addition of the WP "Custom Fields" metabox to the product post type. | WP E-Commerce Custom Meta > Serialized array | wordpress |
From Wordpress Codex (although related to the same function in WPMU and not WP3.0+): http://codex.wordpress.org/WPMU_Functions/switch_to_blog it says: This switch is to be used for internal and admin area functions. It's too expensive a query to run on the front end. in the new page for the same function in WP3+ there'... | For 4 blogs - most likely no. The problems start to appear when you have tens of thousands of posts+ across many blogs, and you want to do queries like getting the latest 10 posts from the network. You should test this yourself, and see if the use of that function (and the others that followed it) significantly affecte... | Is it a bad practice to use switch_to_blog in the frontend? | wordpress |
I get terms from all my posts with <code> get_terms </code> , <code> $tags = get_terms( 'mytags', '&number=5&orderby=date&order=desc&hide_empty=1' ); foreach ( $tags as $tag ) { echo '<a href="'.get_bloginfo('url').'/tags/'.$tag->slug.'">'.$tag->name.'</a>'; } </code> Is it possible to... | Not directly, because terms are assigned to posts, not authors. You will need to query all posts, get their terms and authors, and then filter out terms which came with posts that have other authors than <code> get_query_var('author') </code> . Note that depending on the number of posts your site has, this kind of quer... | Is it possible to get_terms by author? | wordpress |
I would like to test the performance of PHP files in my installation, to find any bottlenecks. I already use plugins like Debug Queries and WPDB Profiler to watch the SQL Queries being generated, but I would like something that shows me the execution time of each php file to identify if some plugin is not optimised. Is... | No. And even if there was, it would be probably useless anyway. You would get incorrect results, because a .php file might call slow functions from WordPress core files, and there are a lot of situations like this. You could try using the xdebug extension, it's pretty close to what you're looking for | Testing performance of WordPress files | wordpress |
How do I use a full code for JW Player plugin , not just the shortcode? I need it so that I can try and use the full code for Lightbox plugin. | You can embed the JW Player anywhere by just using the html embed code: <code> <script type='text/javascript' src='/path/to/jwplayer.js'></script> <div id='mediaspace'>This text will be replaced</div> <script type='text/javascript'> jwplayer('mediaspace').setup({ 'flashplayer': 'player.swf... | Using full code instead of shortcode | wordpress |
I am developing the blog-template of my theme, which works as following: The user can input the total post-count to display on each blog-page ( <code> $blogpost_count </code> ). The blog itself lists post-entries in two different fashions, like so: first, the newest X (X being equal to $blogpost_count) posts are listed... | try: <code> if(!is_paged()) { $post_offset = $blogpost_count; } else { $post_offset = (get_query_var('paged')-1)*2+$blogpost_count; } ... ... 'offset' => $post_offset; </code> | Keeping get_posts' offset and is_paged() synchronized | wordpress |
I have a custom post type called 'contacts'. I want want to remove the status, post date and change the button from PUBLISH to SAVE. From what I can tell this may not be possible without changing core files (please correct me if I am wrong). So, instead of trying to hack the PUBLISH metabox, I have the ability to remov... | Not mine but modified from stackexchange-url ("here"). But if you pop this into functions.php or a plugin it will work. <code> add_filter( 'gettext', 'change_publish_button', 10, 2 ); function change_publish_button( $translation, $text ) { if ( 'yourcustomposttype' == get_post_type()) if ( $text == 'Publish' ) return '... | How to add a SAVE button to replace PUBLISH on a custom post type? | wordpress |
Can I mess up my Wordpress site if I change <code> functions.php </code> file for my custom theme? One time I added some code to it and it gave me some PHP errors and my site was inaccessible. Luckily it was in the early stage of the website so I just reinstalled Wordpress. So, my actual question is - does <code> funct... | <code> functions.php </code> file is where you can do wonders with your theme without touching the core WordPress files. Most of the time the backup <code> functions.php </code> trick would work for you unless you aren't changing anything in the database with any of your action or filter hooks. You could check this lin... | Changing functions.php and .htaccess files | wordpress |
I'm trying to remove the shortcodes from a child theme. In my functions.php file (for the child theme), I've put: <code> function my_remove_shortcode(){ return ''; } add_shortcode('entry-twitter-link', 'my_remove_shortcode'); </code> Where entry-twitter-link is a shortcode created in the parent. However, the entry stil... | Try this out. Remove the already added shortcode then add the new shortcode on the init hook. <code> function shortcode_cleaner() { remove_shortcode( 'entry-twitter-link' ); // Not exactly required add_shortcode( 'entry-twitter-link', 'my_remove_shortcode' ); } add_action( 'init', 'shortcode_cleaner' ); function my_rem... | Removing Shortcodes from Child Theme | wordpress |
I have custom post type "Art masters". Each post is master's profile. In their profiles isset custom fiels name "master_email". I need to send for master email notification every time if new comment is posted. How i can call post new comment function for use wp_mail? Thank you for help! | You can try something like this in your functions.php <code> function send_comment_email_notification( $comment_ID, $commentdata ) { $comment = get_comment( $comment_id ); $postid = $comment->comment_post_ID; $master_email = get_post_meta( $postid, 'master_email', true); if( isset( $master_email ) && is_emai... | If new comment posted in custom post - send notification to custom email from custom field | wordpress |
I'm looking for a quick way to assign custom fields to a selection of posts that I hand pick. What's the best way to go about this? Currently I'm forced to edit each page and manually add the custom field. There's got to be a better way. And no, I don't want to apply it to a post type or a category. | Try magic fields plugin. That is the best custom fields plugin i've tried so far | Assign custom fields to multiple posts? | wordpress |
Thanks in advance. I'd like to have posts with different colored borders and headers. It would be nice to choose a category of the post (red, blue, black, etc.) and have it change the class for that specific post. If it were outside of dreamweaver, it would use classes. So I could say: <code> <div class="red box">... | Use ' post_class ' for custom CSS per post. An example with 3 variations (only use 1): <code> <div id="post-<?php the_ID(); ?>" class="red box" ?>> //idea 1 <div id="post-<?php the_ID(); ?>" <?php post_class('box-color'); ?>> //idea 2 <div id="box-color" <?php post_class(); ?>&... | How to make classes for posts? | wordpress |
I'm using the standard Wordpress theme ( WordPress Default 1.6 by Michael Heilemann). The standard font for my articles is a sans-serif font. I'd like to display, for a sentence only, a serif font ( Times for instance). I didn't find a way to do this. Is it possible ? | This is not really a WordPress question but I'll answer it anyway. The first thing you need to know is CSS is your friend. You'll want to do something like this: In style.css <code> .serif-class {font-family: "Times", "Times New Roman", serif;} </code> Then using the html view inside of your post: <code> <span class... | Locally change the font family | wordpress |
Hi and thanks for reading. I want to insert the post author into my custom post type slug. Example: <code> http://example.com/charts/%author%/ </code> Any ideas how to accomplish this? Here is my custom post type: <code> register_post_type('charts', array( 'label' => 'Charts', 'description' => '', 'public' => ... | I figured out a solution and decided I'd share because its nice to be nice. This works for me and is based on a solution by Jonathan Brinley . If anyone has any suggestions or corrections please feel free to let me know. First, create your custom post type and set it up like this (this is just an example, remember to m... | custom slug for custom post type | wordpress |
In a situation where a plugin has encapsulated its methods within a class and then registered a filter or action against one of those methods, how do you remove the action or the filter if you no longer have access to that class' instance? For example, suppose you have a plugin that does this: <code> class MyClass { fu... | The best thing to do here is to use a static class. The following code should be instructional: <code> class MyClass { function __construct() { add_action( 'wp_footer', array( $this, 'my_action' ) ); } function my_action() { print '<h1>' . __class__ . ' - ' . __function__ . '</h1>'; } } new MyClass(); class... | remove_action or remove_filter with external classes? | wordpress |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.