question
stringlengths
0
34.8k
answer
stringlengths
0
28.3k
title
stringlengths
7
150
forum_tag
stringclasses
12 values
When I try to search for terms with spaces, such as "lord of the rings", it returns all of my posts. However, if I just type "lord", it returns results. Any ideas what would be causing this?
Chances are it's searching using the 'OR' operand, which for will pull up everything that has those common words - 'of the'. There are a number of alternate search plugins for Wordpress - we've had great results (pun intended) using Relevanssi .
Search returns everything if search term has a space
wordpress
I am trying to create a debugging mode in one of my plugins so users can easily enable WP_DEBUG on their own, and hopefully report back to us with helpful error messages. Right now we ask them to modify their wp-config.php, but that's beyond some users' capabilities. I was hoping to just add <code> define( 'WP_DEBUG', ...
WordPress logic forces <code> WP_DEBUG </code> to be defined to something , even if it's omitted it will be set to <code> false </code> in <code> wp_initial_constants() </code> during load. However "background" (that is not when it is checked explicitly) function of <code> WP_DEBUG </code> is to be a flag for how PHP e...
How to define WP_DEBUG as true outside of wp-config.php?
wordpress
i want to remove a certain query in wp 3.1 <code> add_filter( 'query', 'remove_delete_7_day_draft_queries' ); function remove_delete_7_day_draft_queries( $query ) { global $wpdb; $q = "SELECT ID FROM $wpdb-&gt;posts WHERE post_status = 'auto-draft' AND DATE_SUB( NOW(), INTERVAL 7 DAY ) &gt; post_date"; if ( $q == $quer...
I'm assuming you're talking about this piece of maintenance code right here: http://core.trac.wordpress.org/browser/tags/3.3.1/wp-admin/includes/post.php#L419 Indeed, the code calls on lower level functionality of <code> $wpdb </code> , which doesn't contain too many hooks, only one in fact, <code> query </code> . http...
wp remove query
wordpress
I'm trying to both filter and order a Wordpress query using the meta_value, however the <code> ORDER BY </code> part of the query seems to be working on the wrong table. The query params here are: <code> array(12) { ["post_type"]=&gt;"op-events" ["paged"]=&gt;1 ["meta_query"]=&gt; array(2) { ["relation"]=&gt;"OR" [0]=&...
Note: Only read briefly, so I might missunderstood your Q. <code> JOIN </code> on <code> meta_query </code> /post_meta table is pretty ... hm, funny(?) ... as you'll <code> JOIN </code> the table (again) for every key you add - this is a known problem (read on trac). In detail <code> INNER JOIN wp_postmeta ON (wp_posts...
WP_Query filter and order by meta ordering by wrong joined table
wordpress
I am trying to order the output of one of my menus to be based off of the way they are setup in the <code> Appearance-&gt;Menus </code> pane, however it seems to only want to do it alphabetically. For example I have setup in the <code> Menus </code> pane the following hierarchy: <code> Weekly Outlook - Webinars - Calen...
For 'menu_order' to work, you need to set the page order from the page edit screen. Are you setting orders for your pages?
Change order that the menu is generated with wp_list_pages
wordpress
I can't seem to get a good answer on their site. What's the best way to create thumbnails for videos uploaded to my wordpress site? Users upload videos from the front end and I started doing this with only youtube videos which was great because I could just pull the thumbs from youtube. So how can I can auto create the...
I did worked with the plugin YAPB (also possible with standard WordPress thumbnail but needs bit of code moding) and used this setting in the arrays of JW player. It might be not fully automated but you can control your introduction image. <code> &lt;?php if ($post-&gt;image): ?&gt; 'image': '&lt;?php echo $post-&gt;im...
How to create thumbnails in wordpress with jwplayer
wordpress
I currently have a list of categories that go with my 'posts' I want the same categories to go with my custom post types 'services' and 'work' The following code, adds the tags and categories to the work and services custom posts. <code> add_action('init', 'demo_add_default_boxes'); function demo_add_default_boxes() { ...
By default, only post_type post is shown on category pages. To enable your custom post types, you could hook <code> pre_get_posts </code> , check if it's a category page, and if so add your post types: <code> function wpse_category_set_post_types( $query ){ if( $query-&gt;is_category() &amp;&amp; $query-&gt;is_main_que...
Adding Categories across posts, and custom post types
wordpress
I currently do web admin for an internet community based on BuddyPress and Multi Site, and use the <code> Comment author must have a previously approved comment </code> setting to make it easier for users to comment and not be moderated. All users are vetted before their accounts are created so I know we don't have spa...
You could hook into <code> 'pre_comment_approved' </code> and change its return value. Sample code, not tested: <code> add_filter( 'pre_comment_approved', 'wpse47172_approve_logged_in_users' ); function wpse47172_approve_logged_in_users( $approved ) { return is_user_logged_in() ? 1 : $approved; } </code>
Allowing logged in users to comment without moderation across a multisite installation
wordpress
Someone has built a custom plugin that adds a textarea on the admin/edit page, and a div on the pub page. I no longer have access to the person who built the custom plugin. I have created a filter for the main page content by doing something like this: <code> function getHappy($content) { //goofy example str_replace(":...
So the answer was simple, though there may be a better way of dealing with it. In the custom_display.php of the custom theme display page. <code> apply_filters ( 'the_content' , $theContentVar); </code> This may not be best practice, but it works. Hope it helps someone else...
Add a filter to a different custom plugin
wordpress
Can someone please help me to understand each part of this code? Can you comment every line so I can understand and custom the code accordind to my purpose. Here is the link in pastebin: <code> class Towfiq_Person { static function on_load() { add_action('init',array(__CLASS__,'init')); add_action('wp_insert_post',arra...
Basically, this is a programming pattern for namespacing code within a WordPress plugin. Typically, you can only have one function called <code> init() </code> in a program, but more than one author will try to use that name. Placing function names in a class is a way around this limitation. For example: <code> class T...
What does this PHP function code mean?
wordpress
Is there a way I can access the <code> wp_options </code> table of all the child sites? I want to create a multisite plugin that can be setup at the network level and will populate the child site plugins with defaults that can then be overwritten by the each individual site. I'm aware that I could read/write from <code...
Try <code> get_blog_option() </code> . It does not use <code> switch_to_blog() </code> , and so introduces much less overhead. https://codex.wordpress.org/Function_Reference/get_blog_option
Multisite Plugin - Access options (wp_options) on child sites
wordpress
I want to launch my web browser from an automation tool I use and open Wordpress "Add Nwe Post" page in the admin area with specific title and content (it varies everytime, I generate it dynamically on my local machine). I know that I can use http://blog.mysite.com/wp-admin/post-new.php?post_title=sometitle This is fin...
The problem is that <code> $content </code> is a reserved variable in WordPress, you have to use another name. Here, I have used <code> $pre_content </code> : <code> &lt;?php /** * Plugin Name: T5 Editor content by request * Description: Default text for post content from GET variable &lt;code&gt;pre_content&lt;/code&g...
Open Wordpress 'Add New Post' admin page with parameters set via $_GET
wordpress
I recently stumbled across an issue on a site that uses the following URL structure; <code> /%postname%/%post_id%/ </code> An old blog entry had the URL www.mysite.com/my-blog-post/1918/ Since that entry was made there was some media added to the site with the name My Blog Post, meaning the slug for it was also my-blog...
The precedence is determined by the order of the rewrite rules: http://core.trac.wordpress.org/browser/tags/3.3.1/wp-includes/class-wp.php#L196 These map the structure to a query, which is then fed to <code> WP_Query </code> , which has its own defaults. I don't see why you would be landing onto the media post, the <co...
What is the precendence of item types within WordPress
wordpress
I have my live install on one server and a development install on another. I've added a plugin to both but it only appears in the plugin list in <code> wp-admin </code> on one. For a plugin to appear in <code> wp-admin </code> does it need to appear in the database at all? Or is it that just by having the plugin file(s...
The plugin file had Mac line endings so the meta-data comment at the top of the file wasn't being parsed properly. e.g. <code> &lt;?php /* Plugin Name: WP JSON-RPC Plugin URI: http://plugins.voceconnect.com Description: This plugin provides a JSON version of the XML-RPC WordPress API... Author: Jeff Stieler Version: 0....
Is there any record of installed plugins in the database?
wordpress
I Know it's not needed if we're using the latest wordpress but I'm just wondering if it's a good practice to always use it or just use new 3.0+ functions without it, and should we use it for commercial themes ? thanks in advance.
Asking the core WP currently has ~2.5k functions. So if you'd check for every function existence on runtime, then you'd really slow things down. What is it for? When you're looking at wp core or some themes and it's »pluggables«, then you'll see that those are wrapped inside <code> if ( function_exists('fn_nam') ) </co...
Is function_exists() considered a good practice when using 3.0+ functions?
wordpress
I've created a custom post type for my "Testimonials", I don't need a title(s), how can I write a function that Adds the " Edit | Quick Edit | Trash | View " links to "date" if title isn't shown in the column. I'm using the plugin "Admin Columns" to hide the columns I don't wish to show. I'm trying to re-use this code ...
This is not easily done as there is no hook to add the rows actions. You can however, unregister the date column and re-register your own date column with the row actions added. A bit hacky unfortunately. I have tried to ensure that the following code is for post type 'testimonials' First register your new date column ...
Custom post type: Add "Edit | Quick Edit | Trash | View" links to date (if title is not shown in column)?
wordpress
I am creating multiple meta boxes in WordPress, and I want the user to be able to toggle certain boxes on or off. So, they click a radio button (in a separate meta box), update the options, and an additional meta box attached to that radio value will appear. So it basically goes from one meta box (the selector box) to ...
This can be easily solved with jQuery, and it has the advantage of real-time feedback. I've already covered this situation in a couple of questions, so instead of going through your code and writing the proper functions, I suggest you go through my code and adapt it to your needs. stackexchange-url ("meta content on re...
Conditional Meta Boxes
wordpress
I am using Event Manager and they have a custom post type of events, with a taxonomy of event-categories (separate from regular post categories). In that taxonomy I have created terms(?) or event categories, "Education" and "Research". I want a specific <code> &lt;div&gt; </code> to show up if a post is in the event-ca...
<code> in_category() </code> is conditional tag for taxonomy 'category'. With custom taxonomies you should use <code> has_term() </code> conditional, first parameter is term to check for and second is taxonomy. <code> if ( has_term( 'education', 'event-categories' ) ){ echo '&lt;div&gt;Test&lt;/div&gt;'; } </code>
Check if post has specific tag_ID in custom post type
wordpress
I have set up a WPMU setup and used my primary domain as the www. version of topmmorpg100.com This has however caused me a few issues, as a simple command to ping topmmorpg100.com without the www. seems to fail. This is causing some problems when signing up for services of which the domain is pinged and checked for sta...
It's not a redirect issue. I am also unable to ping the <code> www </code> -version of your site as well. Just to test, I also tried to ping your site's IP address directly ... and it also times out. This could be because your server doesn't allow pings. Some servers are set up to block ICMP traffic by default. A ping ...
WPMU Domain not pinging
wordpress
I read about 2 methods for initializing wordpress function outside of wordpress files so We can use these functions on any page or website outside the wordpress blog. Which one of these 2 methods is the correct one? And what is the uses for each method if both are correct? What is the deference between using this metho...
There's little difference between the files. When you view a WordPress page, the first file called is <code> index.php </code> . And it is, essentially, your "Method 1:" <code> define('WP_USE_THEMES', true); /** Loads the WordPress Environment and Template */ require ('./wp-blog-header.php'); </code> The blog header fi...
What is the correct way to use wordpress functions outside wordpress files?
wordpress
My Wordpress theme is using some code in the "sidebar.php" file that tells it that some pages should always use the default sidebar. This was fine until I found that each and every custom taxonomy (example: "taxonomy-mountains.php") page is defaulting to this default sidebar. I thought about catching this with <code> i...
The function that replaces <code> is_taxonomy() </code> is named <code> taxonomy_exists() </code> . Than there's also <code> is_tax() </code> and <code> is_tag() </code> that check if the query is for a taxonomy archive page. EDIT <code> $selected_sidebar_replacement == '0' || $selected_sidebar_replacement == '' </code...
Alternative for is_taxonomy() to workaround theme's default sidebar
wordpress
PROBLEM Hey everyone I have the wp loop to display posts, but I need to exclude category 81. I tried: query_posts('cat=-81'); ?> before the loop but the pagenavi is broken and it doesn't work properly. CODE <code> &lt;?php if(have_posts()): ?&gt; &lt;ol class="list posts"&gt; &lt;?php $end = array(3,6,9,12,15,18,21,24,...
try: <code> global $query_string; query_posts( $query_string . '&amp;cat=-81' ); </code> http://codex.wordpress.org/Function_Reference/query_posts#Preserving_Existing_Query_Parameters
Exclude category from query
wordpress
Can we change the title and alt attributes of the_post_thumbnails and set them to post title instead ? like creating a function for it and adding a filter ? I tried searching but I can't seem to find what I want. and thanks in advance.
Look at this http://codex.wordpress.org/Function_Reference/the_post_thumbnail second argument in this function you can set a few set fields, such as alt, title, source and class: <code> $default_attr = array( 'src' =&gt; $src, 'class' =&gt; "attachment-$size", 'alt' =&gt; trim(strip_tags( wp_postmeta-&gt;_wp_attachment...
How to change post thumbnail title and alt attributes to post title?
wordpress
I would like to have TripAdvisor reviews of a client's restaurant shown on the site, what's the best way to do that? If possible he would like the possibility to check the review first before it is posted to the site.
The best way to do this would be to request access to the Trip Advisor API, available on request here: http://www.tripadvisor.com/APIAccessSupport They only allow a certain amount per year and under fairly strict rules, but I've put in a request with them last year for something fairly similar as what you are requestin...
Trip Advisor and WordPress
wordpress
I've very new to WP and I'm trying to setup a new page which displays only a specific category through the WP admin section. I've downloaded the ACE plugin and I've managed to filter out posts with a specific category from the main page. Now I want to create a separate page which displays only this category, but I can'...
WordPress does not allow adding files though the admin side of things, therefore you will need FTP or SSH access to the server to add a file to your theme directory at least to initially add the template then you can edit it though your hearts content in the admin. (there may be a plugin that allows the admin to add th...
How to add template to theme in WP
wordpress
Hi when I try to enter my site I get redirected to another site. IT appears the htaccess file has been changed. When I scan the site with Sucuri I get this error Known javascript malware. Details: http://sucuri.net/malware/malware-entry-mwhta7 Location: http://ca-no.ru/example/status.php How do I fix this permanently? ...
This is a case of general security. At a minimum do the following steps: Delete the file you found in wp-admin Delete the htaccess file Download the official wordpress from wordpress.org and upload it to your server, overwriting anything it finds. If possible delete the wp-admin and wp-includes folders and any files st...
Malware on site
wordpress
I have my posts ordered ascending (from oldest to newest) because I use Wordpress as a website to accompany a book published based on the original blog. To do this I put the following code just before The Loop in index.php of my custom version of the Connections theme: <code> &lt;?php $wp_query-&gt;set('orderby', 'post...
You can hook into the <code> posts_clauses </code> filter and change <code> ASC </code> to <code> DESC </code> there with a simply <code> str_replace </code> . The filter has one argument <code> $pieces </code> , which is an array of the MySQL statement parts.
Ascending sort order for monthly & category view, i.e. ?m=201204, ?cat=4
wordpress
I have read an article about CND or " Content Delivery Network " which this is really telling myself that if I host a wordpress self-hosting and having a load of traffic I should at least have CDN which will help me improve my loading speed or performance of my site. Come to my question, should CDN be hosted in a diffe...
CDNs work best when the objects - images, scripts - are hosted on a completely different server. Hosting a CDN on the same box that holds your web site defeats the purpose, as the processor, RAM and bandwidth are already being used for the site, and even if the CDN is on a subdomain, your server is still being used. Tr...
Will it make any different if I have CDN on the same host but just different directory?
wordpress
I try the export method of phpmyadmin, but the user is exported with the data... so there is no way to re import it into another database without error message. The old user is name : oldserver_username, and the new server user is called : some_text_server_name_new_user So there is NO WAY i can have the same username t...
The database user name/password is not stored in the database; it is only used to access the database. Change the username (and password, too) to the new values in wp-config.php. And the problem might be access to the database via phpmyadmin; check your username/password in Cpanel or some other hosting control panel.
How to migrate a database from a server to another
wordpress
I did folowed the stackexchange-url ("steps / solution from Jeff") it helped me alot with he's settings, got it for about 90% working properly. But getting stuck on the post / postname. It loads now the producten/%taxonomy_products%/ without the 404 errors. But when i click further on a post i get the 404 errors again....
Thanks for referencing my solution. You forgot one part though - defining the rewrite of your cpt. From my solution: First get your slugs right when defining your custom post types and taxonomies: for the custom post type it should be <code> basename/%taxonomy_name% </code> and the slug for your taxonomy should be just...
Custom permalinks - post type - hierarchical taxonomy's
wordpress
I am trying to add an image uploader to the user profile pages. I do have it up and running on a basic registration page, but somehow the same, but slightly adjusted code does not work when added to functions.php. The field is loaded and WordPress does allow easy updating, but in profile view no image is shown. To get ...
Well thanks everyone for their suggestions. In the end I went for Woothemes Media Uploader integrations as you can see here at Github: https://github.com/devinsays/options-framework-plugin/blob/master/options-medialibrary-uploader.php It is integrated into a theme framework which I am integrating in my own theme so lik...
Get basic Image Uploader on User Profile Page
wordpress
I am running Multisite, and would like to be able to append menu items to all frontend menus on all sites. This should work for menus saved via the admin interface as well as the default menu that is displayed. This code works for saved menu items, but not the default menu: <code> add_filter( 'wp_nav_menu_items', 'your...
add_filter( 'wp_page_menu', 'your_custom_menu_item', 10, 2 );
Edit html for menu items in default frontend menu
wordpress
I am not sure if the title of the question is acurate enough but here it goes. I have set up an Ubuntu server inside a VirtualBox VM, I have enabled port forwarding so when I type on the host <code> localhost:8888 </code> it gets forwarded to the apache running on the guest. I have also set up port forwarding in my rou...
You should be able to just add your port <code> 8888 </code> under general settings wordpress/site url, or directly in your config.php. In your case that would be <code> http://localhost:8888 </code> . I don't know how or what browseling is but a quick glance also shows they support ssh reverse tunnel proxy for localho...
How to change server name on Wordpress Installation?
wordpress
I want to make video posts redirect to the next video post in it's category after it's over. I use both youtube videos and directly uploaded videos both of which I already know how to pull the duration in seconds. How can I use them to accomplish my goal?
Notes before What you're asking for is a highly complex thing: Load next post after WP internal Data finished, played with some 3rd party player Load next post after YouTube player (javascript or ActionScript) finished The problem is not the redirect 1) , but more how you want to know how &amp; when to load the next po...
Make a video post redirect to next post after completion
wordpress
I'm trying to create a shortcode base on the following code: <code> &lt;ul class="filter"&gt; &lt;li&gt;Filter:&lt;/li&gt; &lt;li class="link-store"&gt;&lt;a href="&lt;?php echo get_permalink( 23 ); ?&gt;"&gt;All&lt;/a&gt;&lt;/li&gt; &lt;?php global $post; $thispage = $post-&gt;ID; // grabs the current post id from glo...
A shortcode has to return just a string, you should not print something like in <code> wp_list_pages() </code> or <code> echo </code> . From Shortcode API : The return value of a shortcode handler function is inserted into the post content output in place of the shortcode macro. Remember to use <code> return </code> an...
short code output too early
wordpress
I'm doing the migration of a site, from MovableType to WordPress. The website contains around 3500 posts and when I uploaded the information to the new version of the site, the links have been altered. Old site link (note that the category-name and the nodenumber are not fixed values. The nodenumber is a number that ch...
Have you looked at the Redirection plugin? You could make a rewrite rule for something like this: <code> /([^\/]+/([1-9]+)/([^/]+)/? </code> and then have it redirect to <code> http://newsite.com/$1/$3 </code> , or something along those lines at least. I think you could do this with <code> .htaccess </code> as well, bu...
Mass .htaccess URL Forwarding
wordpress
I am working on a custom child theme for Wordpress and I can not seem to get a footer width of 100% to be represented. Live Example Page : http://glustik.com/wordpress/ I have tried multiple things, but I cant get the footer background to show up, the contents of the footer show up fine. Here is the Footer Code I am Us...
Looking at your code, I don't see anything obviously wrong, but using Safari's inspector, it becomes clear that the footer DIV is not invoking the #footer CSS rule. Not clear why. If the header div and footer div have the same styling, you can simplify your code by using one set of styles: #header, #footer {...}. Less ...
100% Width Footer - Custom Child Theme
wordpress
Am i wrong in thinking i can access the search page by using /search/ ? I've created the files search.php &amp; searchpage.php but /search/ still returns 404? I want to customise the page a bit... best, Dan.
You should be able to access search pages via <code> search/foo </code> as well as <code> ?s=foo </code> . This search rewrite rule is built in into WP since version 1.5. I tested it and it works. As for the template files, you will need <code> search.php </code> , <code> searchpage.php </code> is not used. Also see: h...
search page not found? (search.php or searchpage.php)
wordpress
I'm trying to create a function for the title inside my functions.php, I'm having a problem with the search title part where I have to concatenate here's the part with issues: <code> elseif (is_search()) { _e('Search for ', 'textdomain') . '&amp;quot;' . esc_html(the_search_quey()) . '$quot; - '; } </code> this one giv...
<code> the_search_query() </code> echoes itself, so by putting it into another echo function (what <code> _e() </code> is) you'll get result as in second example. It isn't recommended to use variables or function inside l18n functions, because they can't be translated, for more information see Otto's: Internationalizat...
How to concatenate inside the _e() function the right way?
wordpress
im developing a logic for populating 3 custom taxonomies into 3 drop downs, i have a custom post type dealers and under that i have 3 taxonomies 1. State 2. City 3. Manufacturer when i select the state i have to populate the cities that are related to the state, and when i select the city and i have to populate the man...
Without having some kind of relationship defined between the taxonomies its very hard to achieve and not scalable, meaning that you would have to: catch the change of the state (first) dropdown and then get a list of all posts with that taxonomy term ( first Query ) then loop over all posts and get the list of cities t...
triple drop down for populating custom taxonomies
wordpress
I've been searching the codex, and I'm probably overlooking something somewhere, but could someone tell if it would be possible to remove a button/quicktag from the WordPress html editor? http://i.stack.imgur.com/dZBTT.png
With the quicktag_settings filter: <code> function wpa_47010( $qtInit ) { $qtInit['buttons'] = 'strong,em,link,block,del,img,ul,ol,li,code,more,spell,close,fullscreen'; return $qtInit; } add_filter('quicktags_settings', 'wpa_47010'); </code> The default is: <code> $qtInit['buttons'] = 'strong,em,link,block,del,ins,img,...
Removing buttons from the html editor
wordpress
I need access to my Theme's version number a number of times on each Admin Page view. Right now I'm using <code> get_theme_data </code> which in turn parses the Theme's <code> style.css </code> file via <code> get_file_data </code> , so <code> style.css </code> gets parsed multiple times. Is there a built-in caching me...
In the mean time, keep using your method. But as @helenhousandi linked in a comment, WordPress 3.4 will be introducing a new <code> WP_Theme </code> object that will make this much easier. Right now, you're using <code> get_theme_data() </code> to return an array with the theme's version. No, it's not cached ... but yo...
Is the current Theme version number cached somewhere?
wordpress
I apologize if this is a dumb question, but I am just learning PHP and Wordpress. It's probably very simple. I have a site where the top-level nav is all parent categories, with the child categories as dropdowns. The pages are all pulling from category.php. On the child category pages, I would like to display the curre...
Add a check wherever you're displaying the title: <code> //Anything greater than 0 means the category has parents, 0 means no parent, child category if($category-&gt;category_parent &gt; 0){ echo $category[0]-&gt;cat_name; } </code> This should help.
how to display page title only for child category pages
wordpress
I found Morris.js to be a delightfully implemented charting script, and wanted to include it in my Wordpress installation. But I have never included a js file with my blog before, and would appreciate if someone can guide me on this: How do I include the javascript file? Where do I upload it on the server? Anything els...
Create js folder in your theme directory then save Morris.js into it. it is not mandatory to store it in js folder you can store it anywhere else but i recommend to do it to seprate javascipt files from other files. Add follwing action into functions.php file <code> function custom_scripts() { /* Include Scripts */ wp_...
Morris.js for Wordpress?
wordpress
I have created a page with the php comment at the start of the file: <code> &lt;?php /* Template Name=&gt; Team Detail */ ?&gt; </code> and saved it as team-detail.php in my theme's root directory. Now when I want to add a page with this as the template for that page, I cannot see this template in the admin area under ...
First of all, change <code> Template Name=&gt; </code> to <code> Template Name: </code> . Also, when you say the themes root do you mean <code> wp-content/themes </code> ? If so, keep all your files in a folder specific to your theme i.e <code> wp-content/themes/myTheme </code> . If you've done that, make sure you've g...
Wordpress 3.3.1 Page template not showing in admin area
wordpress
I have added a custom field to the image attachement. When this custom field is checked the image will be part of a carousel on the home page. Now i am able to get the custom field to work and save the selected value, but how do i query the database so only the post with the custom field checked will be selected and th...
<code> &lt;?php $args = array( 'post_type' =&gt; 'attachment',***'meta_key'=&gt;'your meta key','meta_value'=&gt;'your meta value',*** 'numberposts' =&gt; -1, 'post_status' =&gt; null, 'post_parent' =&gt; $post-&gt;ID ); $attachments = get_posts($args); if ($attachments) { foreach ( $attachments as $attachment ) { echo...
How do i get the attached images with custom value checked?
wordpress
I am new there and I need some help for importing a wordpress blog. I have a old wordpress 3.1 blog (no multisites) and need to move to new hosting (a sites under multisites). I don't have the access of database so I do a wordpress export. Then I do the wordpress import as usual, with <code> Download and import file at...
Well, I found the answer by myself. I finally get into update the attachment by myself. I found the default attachment UI is totally a pain, so I use bulk change attachment parent to change the media id when I know the post id. (It is OK for about 50 images) The only problem with that plugin is the bulk change part doe...
Media is not attached after import
wordpress
I would like to use gravatar image as background image for a button. When i use <code> get_avatar </code> function it returns with height width src parameters. But i need only gravatar url. I mean like <code> http://gravatar.com/.../... </code> Can anyone tell me how? Thanks
Just generate the URL yourself. It's just a hash of the user's email address. <code> function get_gravatar_url( $email ) { $hash = md5( strtolower( trim ( $email ) ) ); return 'http://gravatar.com/avatar/' . $hash; } </code> This function requires that you pass the user's email address in ... but you could do anything ...
How to get gravatar url alone
wordpress
I've just received this error/warning after trying to upload an image, any ideas what it means and what I can do to fix it? Warning: Cannot modify header information - headers already sent by (output started at /home/achenn/public_html/wp-content/themes/whskytngfxtrt/functions.php:14) in /home/achenn/public_html/wp-inc...
From the looks of things, some page is trying to load your <code> functions.php </code> page directly. I'm not sure if it's another part of your theme, or a plugin, or some other custom code. But the error on line 14 is triggered with a second <code> &lt;?php </code> opening tag in your <code> functions.php </code> fil...
Warning: Cannot modify header information - headers already sent
wordpress
I have a bunch of posts that each have multiple tags, and I'm trying to find a way to output all of them on a single page, organized under an alphabetical listing of their respective tags. E.g. if Post1 has the tags A, B and D and Post2 has the tags A, C and D, the output would look like this: Tag A Post1 Post2 Tag B P...
(Untested) but should works with any taxonomy including the 'tag' taxonomy ( <code> post_tag </code> ). The following example uses the taxonomy with name 'my-taxonomy'. <code> &lt;?php //Get terms for this taxonomy - orders by name ASC by default $terms = get_terms('my-taxonomy'); //Loop through each term foreach($term...
Loop through all tags & output posts in alphabetical list
wordpress
Isn't there a permalink structure that will essentially list out all <code> categories </code> of a certain <code> post type </code> ? <code> function create_faqs_post_type() { register_post_type( 'faqs', array( 'labels' =&gt; array( 'name' =&gt; __( 'FAQs' ), 'singular_name' =&gt; __( 'FAQ' ) ), 'public' =&gt; true, '...
@dcolumbus You can do a permalink rewrite when you register the taxonomy using the following: 'rewrite' => array( 'slug' => 'faqcategories', 'with_front' => false ), Then site.com/faqcategories should pull them and site.com/faqcategories/easy should get them for you for the 'easy' term. If I'm understanding you correct...
Custom Post Type: How to display all of same taxonomy?
wordpress
Just wondering how to filter to change the current page title from a shortcode, Since shortocodes are rendering after $post. any idea to archieve something like : <code> do_shortcode(['mytitle="newtitle"']); </code>
why not to use the_title filter? <code> add_filter('the_title', 'the_title_filter'); function the_title_filter($title){ $post = get_post(get_the_id()); //enter code here return $title; } </code> as for shortcode - its imposible. in logical way - imposible.
filter title from shortcode
wordpress
I'm trying to edit the Q&amp;A Plugin (which for those of you that don't know it is a StackExchange-style plugin with Custom Post Types of Questions and Answers) to incorporate image uploads. It seems to use the built-in TinyMCE editor that came bundled with recent versions of WP. This comes with the "Media Library" bu...
A simple solution may be to download the Members Plugin and then give the <code> subscriber </code> permission to <code> upload_files </code>
Front-end image upload from TinyME
wordpress
I can't stop my custom post types from sporadically 404ing. It doesn't always happen and I can't predictably replicate the problem - as in sometimes it happens, sometimes it doesn't. However, once I clear the cache, the 404 always goes away and the URL works. I have tried resetting and re-saving the permalinks, which a...
Since you're hosted by WPEngine, I recommend contacting them directly and asking for advice. It might be that your CPT isn't reliably making it into their cache for some reason, but they can give you a better answer than any of us. You should definitely escalate the ticket you've already submitted for the issue. If it'...
cutsom posts 404ing
wordpress
i am trying to add an image field to the wp_term table in the database, I'll call it icon. I want that filed to contain a URL to an image that will be the thumb for the category. I have already added the field to the DB and I have also inserted it into the code in the admin panel : <code> &lt;?php if ( is_taxonomy_hier...
I had some trouble saving custom taxonomy fields, which I resolved in stackexchange-url ("this WPSE post"). I was using the options table to save my data, but the same solutions may apply for you too. Firing callbacks attached to <code> create_{taxonomy} </code> and <code> edited_{taxonomy} </code> were part of the sol...
add an image field to wordpress category
wordpress
We currently have about 50 pages, each of which I want a user (eg, bob, rob, smith) to be able to edit only 1 page. For example, bob &amp; smith each have their own page. I do not want bob to be able to edit smith's page. I want bob to ONLY be able to edit bob's page. I don't care if he can see other pages. Looking thr...
The Role Scoper plugin can enable this.
Allowing users to edit only their page and nobody else's
wordpress
I am creating a new baseball blog. When submitting a post, I want Authors to cite their source for a news type of post. I have created a custom meta box with three custom fields: Source title, the title of the source. Field name - source_title Source URL, the URL of the source. Field name - source_url Source name, the ...
I'm not sure if I'm meeting all of your requirements here, but I think this might work. <code> &lt;div class="source"&gt; &lt;?php $name = get_post_meta($post-&gt;ID, 'sourcename', true); $url = get_post_meta($post-&gt;ID, 'sourceurl', true); $title = get_post_meta($post-&gt;ID, 'sourcetitle', true); $snippet = str_rep...
Create citation and url in post using 3 custom fields with conditions for each field... So close!
wordpress
i have a single-post_type.php file where i constructud a breadcrumb (or similer to) i am currently using this to get the terms of this taxonomy: <code> $terms = wp_get_post_terms( $post-&gt;ID, 'wedding_cat'); </code> . Later on i am showing that term like this: <code> &lt;div class="breadcrumbs"&gt;&lt;?php $term = ar...
I'd use <code> wp_list_filter() </code> with the operator 'NOT' to compare either the term's name, slug or ID (depending how you want to test for term to be exluded). Untested but something like this should work (assuming that you want to exclude the term with slug 'myslug'): <code> $terms = wp_get_post_terms( $post-&g...
Exclude specific taxonomy term when using wp_get_post_terms
wordpress
In the following query, post_type seems to get ignored resulting in display of all posts from my installation. What have I done wrong? <code> &lt;?php function filter_where( $where = '' ) { $where .= " AND post_date &gt; '2009-03-01'"; return $where; } add_filter( 'posts_where', 'filter_where' ); $posts = query_posts( ...
Check if your post_type is exactly <code> listings </code> and not <code> listing </code> . Also check this approach: <code> &lt;?php function filter_where( $where = '' ) { $where .= " AND post_date &gt; '2009-03-01'"; return $where; } add_filter( 'posts_where', 'filter_where' ); function parse_wp_query( $query ) { $qu...
Why would post_type be ignored in this query?
wordpress
In wp-admin/includes/media.php I found this: <code> function media_buttons($editor_id = 'content') { $context = apply_filters('media_buttons_context', __('Upload/Insert %s')); $img = '&lt;img src="' . esc_url( admin_url( 'images/media-button.png?ver=20111005' ) ) . '" width="15" height="15" /&gt;'; echo '&lt;a href="' ...
<code> function adcp_change_media_button( $context ) { // $context acutally IS 'Upload/Insert %s', so we simply drop in in some other string return __( 'Upload/Insert images, documents, etc %s', 'YOUR_TEXTDOMAIN' ); } // Then use the right filter name add_filter( 'media_buttons_context', 'adcp_change_media_button' ); <...
Changing the text of Upload/Insert on Posts and Pages Screen
wordpress
I've recently installed a wordpress network to my website and i'm stuck with a huge problem! my default blog now redirects to the signup form automatically and not the blogs home page. I have set the static page in the reading settings, and disabled registrations. it still redirects to domain.com/wp-signup.php?new=doma...
Solved this, all it is is a missing <code> define( 'NOBLOGREDIRECT', 'http://www.domain.com' ); </code> from wp-config.php
Registration Page
wordpress
Apologies if the title isn't clear, can't quite think how to word this. I'm getting a pretty standard list of posts like this: <code> $pageposts=$wpdb-&gt;get_results(" SELECT * FROM $wpdb-&gt;posts WHERE post_type='post' AND post_status='publish' ORDER BY post_date DESC LIMIT 6 ", OBJECT); $firstpost = array_shift($pa...
once you have set of result in particular order you can achieve it simply as below : - <code> $pageposts=$wpdb-&gt;get_results(" SELECT * FROM $wpdb-&gt;posts WHERE post_type='post' AND post_status='publish' ORDER BY post_date DESC LIMIT 6 ", OBJECT); </code> First time <code> $i=1; foreach($pageposts as $pageposts_fir...
PHP get the first post separately from array returned by wpdb-> get_results()
wordpress
I am am trying to add a function to my custom menu. The menu works, but I have no idea on how to get the <code> custom_execute_shortcode() </code> function to work inside the <code> add_profile_link_to_nav() </code> function. Any help appreciated. <code> //--Nav Menu function add_profile_link_to_nav(){ if ( is_user_log...
Simple, don't bundle the function inside. Instead, break it out like this: <code> //--Nav Menu function add_profile_link_to_nav(){ if ( is_user_logged_in() ) { ?&gt; &lt;ul&gt; &lt;li class="menu-item"id="one"&gt; &lt;a href="http://example.com/members/"&gt;All Members&lt;/a&gt; &lt;ul class="sub-menu"&gt; &lt;?php ech...
Add function to custom menu
wordpress
I have some custom fields added via a meta box, and I'd like to output them into a dl on the post itself, with the field being the term and the data it contains being the term. Currently, calling <code> &lt;?php the_meta(); ?&gt; </code> outputs an unordered list. Example: <code> &lt;dl&gt; &lt;dt&gt;Date&lt;/dt&gt;&lt...
You can use get_post_meta() function to retrieve values of fields. Example : To retrieve the value of date metabox use following code. <code> get_post_meta(get_the_ID(), 'date', true); </code>
Custom fields / meta box output
wordpress
I'm a programmer at a domain registrar and web hosting company. In the past year or so we have branched into custom web design for individuals and small businesses. Currently all our solutions are WordPress-based. We find that we have a small but vocal group of clients that are not ready for custom web design, and are ...
What you're wanting essentially is to not have to intervene, to let the customer do it all without needing human intervention by the company other than when things go wrong, am I correct? Of note, Wordpress.com already operates in an environment where the end user can do it all themselves. I estimate the time needed to...
Recommend an open source, template driven website builder UI that produces a working WordPress site
wordpress
I'm trying to figure out how to get rid of the whitespace on this page: http://www.seccbiblebowl.org/calendar/ I need the calendar to be full page. On the edit page screen, there's an option to set the template as "full page, no sidebar" but it doesn't expand my content area. Is there a setting I'm missing?
In the theme you have choosen (twenty ten) - the main Container where you page / post is posted is the div: <code> &lt;div id="content" role="main"&gt; &lt;!-- YOUR CONTENT IS PUBLISHED HERE --&gt; &lt;/div&gt; </code> . This div has a maximum width of 640 pixels... if you want to change that you can do one of three th...
How to use the full page
wordpress
I am creating a baseball website with multiple Authors. From past experience, no matter how well you know someone personally, it doesn't mean they will follow or even read your instructions. That being said, I would like to require that any image an Author decides to "Use as featured image" be at minimum of 640px wide ...
well if you are using WyPiekacz plugin; as you said for checking that featured image is uploaded, you can tweak it little bit to check that if there is featured image it is of minimum dimesions as you required. <code> $has_thumbnail = false; if ( ( $post_id &gt; 0 ) &amp;&amp; function_exists( 'has_post_thumbnail' ) ) ...
Minimum Dimensions Requirement for Featured Image?
wordpress
I'm using the shopp e-commerce plugin. In my template file I need to get the id of the product (post). The online docs for shopp list <code> shopp('product', 'id') </code> but irritatingly this prints the id and there appears to be no alternative that simply returns it. Also confusing, when I do <code> $post-&gt;ID </c...
It's turns out that you can add <code> return=true </code> to any of the theme template tags: <code> shopp('product', 'id', 'return=true'); </code> As of writing this, that is not mentioned in the documentation at all. Shopp support was also able to confirm that the $post-> ID variable does get over-written in a number...
Can't retrieve product (post) ID using Shopp e-commerce plugin
wordpress
I have this irritating problem with a post in Wordpress (see the url below). http://www.bytewire.co.uk/services/website-design-essex/ You'll notice the second lower case bold heading (Why Bytewire for website design essex?) is pushed down from the adjacent picture by a br which Wordpress seems to be silently inserting....
Switch to the HTML editor and you'll be able to see all of your page markup. You likely have an unclosed tag or extra line return somewhere in the content, so the visual editor adds additional markup to clean that up.
Wordpress br in content problem
wordpress
I'm using the permalink structure "/%category%/%postname%/". What bothers me is that I have posts that belong to two categories. And of course, unfortunately, Wordpress always picks the wrong one for the slug generation. Is there a nice and clean way of having control on which category will be chosen for the post slugs...
WordPress picks the lowest ID as its main permalink. However, ALL categories will contain your post automatically. Meaning both these: http://yoursite/category-A/post-A http://yoursite/category-B/post-A ...will return your post (given that post-A is in both category-A and category-B) via a redirect. It can't list them ...
How to control which category will be picked for the slug of a post?
wordpress
Pagination for a custom post type in category.php returns a 404 page for /page/2. If I go to /page/1 it redirects and works fine, but /page/2 breaks. Permalinks are set to <code> /%postname%/ </code> I've tried all the fixes I have seen on google, but nothing works <code> &lt;?php get_header(); ?&gt; &lt;div class="hom...
<code> function category_set_post_types( $query ){ if( $query-&gt;is_category ): $query-&gt;set( 'post_type', 'any' ); endif; return $query; } add_action( 'pre_get_posts', 'category_set_post_types' ); </code> This worked!
Pagination on category pages using wp_pagenavi causes 404 errors
wordpress
I tried to add a page template to upload zip files and extract on fly. i do it correctly except attaching extracted files to media files and post attachments only zip file attached. <code> $post_id = wp_insert_post($new_post); if (!function_exists('wp_generate_attachment_metadata')){ require_once(ABSPATH . "wp-admin" ....
After you unzipped the file to <code> $folder['path'] </code> you have to manually add all unzipped files to the $_FILES array and do media_handle_upload, etc. for them. You are iterating over it, so you may create a temporary $unzippedfiles array and push all unzipped files into it. You have to create for each file an...
Attach unzipped files to wordpress
wordpress
I have a "change password" page. Is there a way to redirect that page when the user <code> login first time </code> using wordpress generated password? Thanks
Maybe this helps you? stackexchange-url ("stackexchange-url He seems to had a similar problem and solved it a year ago. What he does different to your approach is redirecting 48hrs after registration. Maybe this is enough? If not - I'm looking to do it your way. --- EDIT Okay I just made a plugin what does exactly what...
Password change when the user login first time
wordpress
Is there a way to give users the option to log in to their favorite group on login? So if a user belongs to say half a dozen groups I can show those groups on the login with some sort of drop down menu and have a checkbox they can tick off to select the Buddypress group they want to log directly into.
+1 to what @Bainternet said. The only way I can imagine is if you used some ajax on the username field, so that when a username was entered (on <code> blur </code> maybe), a request would be sent to get that user's groups. I would never do this, however, as it would allow anyone to look at a list of a user's groups mer...
Is there a way to give users the option to log in to their favorite group on login?
wordpress
So I got this to sort my posts and it works great: <code> &lt;div class="sort"&gt; Sort by &lt;select onclick="if (this.value) { document.location = this.value; }"&gt; &lt;option value="" selected="selected"&gt;Latest first&lt;/option&gt; &lt;option value="&lt;?php echo $short_page_url; ?&gt;?orderby=date"&gt;Oldest fi...
I would do something like this: <code> &lt;script type="text/javascript"&gt; //http://www.netlobo.com/url_query_string_javascript.html function gup( name, default_value ) { name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]"); var regexS = "[\\?&amp;]"+name+"=([^&amp;#]*)"; var regex = new RegExp( regexS ); var re...
ASC and DESC separately from orderby
wordpress
it works everywhere on my site but it isnt working in category.php. When i click page to it goes to... domain.com/category/ cat-slug /page/2 by the way this is showing custom post types within certain categories (no actual plain 'posts') But when the page loads its just the 404 page? When i go to /page/1 it works fine,...
<code> &lt;?php $catname = wp_title('', false); $wp_query = new WP_Query(); $wp_query-&gt;query('category_name='.$catname.'&amp;showposts=5'.'&amp;paged='.$paged); ?&gt; &lt;?php while ($wp_query-&gt;have_posts()) : $wp_query-&gt;the_post(); ?&gt; &lt;?php the_title(); ?&gt; &lt;?php } ?&gt; &lt;?php endwhile; ?&gt; &l...
pagination not working for category.php (custom post types in categories)
wordpress
Im trying unhook the comment form found in the functions.php of the deafault buddypress theme so I can change it a bit. I placed this piece of code into my child theme functions.php but it didn't change anything. What did I do wrong? <code> remove_filter( 'comment_form_defaults', 'bp_dtheme_comment_form', 10 ); if ( !f...
Solved - I didn't realize wordpress overwrites the functions in the default theme if I place them in my child theme functions.php. So all I had to do was paste them into my functions.php and edit how I want them.
Unhook the comment form in Buddypress
wordpress
I'm using facebook connect plugin. Usernames generated by that plugin look like firstname_lastname. I mean it looks ugly. I would like to give the privilege to my users to change the username BUT ONCE . I hope its like changing the password. Here is my change password function . Can anyone help me to modify it? Thanks
Just add a meta record that tracks the state of the username-changing actions: <code> $user = wp_get_current_user(); $did_one_change = get_user_meta($user-&gt;ID, 'changed_username', true); if($did_one_change !== false) wp_die('You already changed your user name once!'); wp_update_user(array( 'ID' =&gt; $user-&gt;ID, '...
One time username change from frontend?
wordpress
I would be grateful if someone could point out a link. I understand this may have a very lengthy answer but I searched and couldn't find any resource. Alternatively, it would also be nice if someone can just state the order in which hooks are fired. I'm sure there wont be many since I am only concerned about the "publi...
What exactly do you mean with "published"? One thing you can try is this : http://planetozh.com/blog/my-projects/wordpress-hooks-filter-flow/ The script runs in your WordPress root (or in /wp-admin/ if you prefer) and enumerates filters that are loaded in your blog. Hooks are displayed alphabetically, and for each hook...
In what sequence are the hooks fired when a post is "published"?
wordpress
Wordpress currently uses the <code> gettext </code> feature which is available in <code> php </code> but unfortunately not in <code> Javascript </code> . I have searched this matter on the web and have come up with stackexchange-url ("this trick"). But there is a problem as the php file needs to be called through <code...
WordPress has a nice function mainly for that wp_localize_script To use it first queue your script: <code> wp_enqueue_script( 'My_Script_handle', 'path/to/script.js' ); </code> then create an array of strings you want to localize: <code> $data = array( 'exit' =&gt; __( 'Exit','my-plugin-domain' ), 'open' =&gt; __( 'Ope...
Localiztion in javascript
wordpress
I use the media uploader in a own meta-box for a custom post type called "premium". The Thickbox opens after a click of the button in the meta-box and files can be uploaded. Now I want to remove the tabs "From URL" and "Library" only when used the uploader in the edit/new-page for the CPT or if possible with the call o...
You can use the <code> media_upload_tabs filter </code> check for your post type and unset any tab you don't want ex: <code> function remove_media_library_tab($tabs) { if (isset($_REQUEST['post_id'])) { $post_type = get_post_type($_REQUEST['post_id']); if ('premium' == $post_type) unset($tabs['library']); unset($tabs['...
Remove tabs from media uploader for a CPT
wordpress
I want to use something like <code> previous_post_link('%link','',TRUE ) </code> and put the path into a javascript variable. So using something like <code> var previous = "&lt;?php previous_post_link( '%link','',TRUE ); ?&gt;"; </code> outputs : <code> &lt;a href="http://www.website.com/photo/1085" rel="prev"&gt;&lt;/...
Add following function in your functions.php file. <code> function custom_post_link($format, $link, $in_same_cat = false, $excluded_categories = '', $previous = true) { if ( $previous &amp;&amp; is_attachment() ) $post = &amp; get_post($GLOBALS['post']-&gt;post_parent); else $post = get_adjacent_post($in_same_cat, $exc...
Get only the path from a function like previous_post_link
wordpress
I write posts about math and computer science. Many of those posts need some previous knowledge. I would like to create a box for some articles with links to these basics, simmilar to UbuntuUsers . In my articles I would like to add them like this <code> {{previousKnowledge|&lt;a href="..."&gt;first&lt;/a&gt;|&lt;a hre...
First of all : Cool idea. I don't know whether there exists a plugin for this task, but I would simply implement this as a new small plugin. I would recommend changing your syntax, so that it won't contain the links as html. I changed it to: <code> {{previousKnowledge|first=...|second=...}} </code> Here is my simple fi...
How can I create custom in-post templates?
wordpress
Is there anyway to recover login credentials to Wordpress admin through the code somewhere? I just tried wp-config. I'm asking because my email is not primary on the account so using 'Forgot Password' wouldn't help much as I need to get in now? (I have FTP / Host access.)
You can do that via the database but you should be carful and backup the database befoure any changes are done first here is a link to md5 encoder (youll need it): MD5 Encoder Hope this help... Sagive
Recovering WP Login Credintials in Code?
wordpress
What I'm trying to achieve: Have images in blog posts take the full width of a blog post, and keep image proportional. Aka, a portrait image will end up being bigger than landscape. The challenge, I'm not using images from my wordpress server, but from smugmug. Hense, I'm using embed images like this one (just drop the...
this is what should work for you based on the link you provided in your edited answer: <code> .postcontent img { height: auto; width: 630px; } </code> and that can go in your custom.css file. Make sure to clear your cache and refresh after making the change.
How to have embedded images from smugmug take full width of blog posts
wordpress
I'm not looking for a share this post button for the front end. I've seen a couple of similar topics here but not exactly what I'm after. What I would like is a plugin which offers the options in the admin panel to post a link my post to a facebook page, tweets it, perhaps takes the images and sends to flickr and so on...
What about Network Publisher ? Supports 25 networks, probably all you need. Worth noticing: It uses a third-party service LinksAlpha .
a plugin to share a post to social networks via admin?
wordpress
This is my current .htaccess file: <code> Options +FollowSymLinks RewriteEngine on RewriteRule (.*) /directory/ [R=301,L] </code> And "directory" is where my wordpress install is. So this simply redirects people from the root domain to the directory. What I would like to do is create it so any information added to the ...
<code> Options +FollowSymLinks RewriteEngine on RewriteRule (.*) /directory/$1 [R=301,L] </code> http://httpd.apache.org/docs/current/mod/mod_rewrite.html#rewriterule look at "backreferencing"
How can I create a smarter .htaccess file that will add a directory?
wordpress
Is possible to change page title on the fly from plugin? I've try global $post, but seem like plugin runs after. Any Ideas? Edit: Im writting some pages on the fly, based on same page / post, so every page show the same title. Looking a way to do via shortcode or writting my own plugin/function
There's a filter for that: <code> function wpse_alter_title( $title, $id ) { // $id = $post-&gt;ID; // alter the title here return $title; } </code> If you want to alter the "Protected" and "Private" titles, then you need other filters: <code> // Preserve the "%s" - else the title will be removed. function wpse_alter_p...
Change page title from plugin
wordpress
I have an issue with a clients site. I installed the Yoast SEO-plugin (which i find to be great), but when i activate it i get lot's of error messages (See below). <code> /storage/content/10/104610/mydomain.com/public_html/wp-content/plugins/qtranslate/qtranslate_hooks.php on line 54 Notice: Undefined index: language i...
As the errors tell you it is caused by badly written code. What you can do: Ask the qtranslate developer to fix these issues, file a proper bug report and add the errors to it. Then wait for an update.
qTranslate conflicts with SEO-plugins
wordpress
How do I create a custom wordpress slideshow plugin? I've been looking for the tutorials on google but I couldn't find one, would you guys mind giving a tutorial here or link to some other custom slideshow plugin tutorials?
So... this is my slide show implementation: This is the code i use to create a slideshow based on the flexslider JQuery plugin (Thank you David!). It also gives the user a checkbox so he can chose what pictures to include in the slideshow, and what pictures to skip. The images are taken form the post attachments, if yo...
How do I create a custom wordpress slideshow plugin?
wordpress
Provided you are working on a php 5.3+ only package what are the namespace conventions when it comes to plugins <code> Funky_Monki\Banana_Blogger_Plugin\Admin::Banana_Tosser Plugins\Funky_Monkey_Banana_Blogger\Admin::Banana_Tosser? </code>
There are no such conventions for WP. But I would recommend to use such style: <code> Plugins\Your_Company\Your_Plugin\Your_Component\Your_Class </code>
Naming conventions when using (PHP5) namespaces?
wordpress
i have searched and found some aprroved answers to similer questions but nothing i could make work or something exactly like my issue... i have 5 custom post type... each one have its own taxmonies and inside all of them i have created a category called specials... i need to pull all posts marked with this category fro...
At a glance, I would guess that the problem is your use of <code> 'relation' =&gt; 'AND' </code> Using <code> AND </code> means that you will only return items that fall into all of the taxonomy terms. If you want to return items have any of the taxonomy items, change it to <code> 'relation' =&gt; 'OR' </code> If that ...
Query Multiple Taxominies Across Multiple Post type's
wordpress
I am using wordpress get post meta to store the value of a custom field into a variable. In this particular instance, It is actually grabbing the post's parent's custom field due to the <code> $post-&gt;post_parent </code> Here is the code: <code> &lt;?php $cast_members = get_post_meta($post-&gt;post_parent, 'cast_memb...
Change above code to like this: <code> &lt;?php $cast_members = get_post_meta($post-&gt;post_parent, 'cast_members', true); ?&gt; &lt;p&gt;&lt;?php echo wpautop($cast_members); ?&gt;&lt;/p&gt; &lt;?php endif; ?&gt; </code> in this code wpautop() function automatically adds p tag for cast members.
Wordpress stripping out custom field tags
wordpress
I have a projects that needs a homepage similar to this one . I know there are many multi-language plugins out there. Here's exactly what I need: <code> if isHomepage and noLanguageSeleted show selection page else show the actual page content in the sleeted language. show all the links and menus in the selected languag...
The absolute best plug in for this is WordPress Multi Lingual (WPML) . I have used this on multiple sites, it works like a charm!.. and it provides excellent documentation for custom theme builders :) Are you using a free theme? a paid premium theme? or are you building you own theme? If you are building your own you n...
How to create a language selection homepage?
wordpress
The second parameter in the translate function is optional, but I always see people use it and some don't. So I want to know if I should use it or not and if yes, how I will use it later. I asking this because I'm new to this, and I'm using e() and _ () right now in my theme, and I'll learn how to translate it when I f...
Welcome to WPSE Peter, The second argument is a translation domain . This is essentially where the translation for the first argument can be found. By default it checks the WordPress language folder - but if you are creating a custom theme or plug-in, you cannot rely on the translation for that string to be there (afte...
Why set a second parameter in the translate function?
wordpress
I am trying to make may own Wordpress theme. I want the scenario of blogpost lost DIVs blocks are equal in rows. I am using very cool JQuery tutorial from CSS-Tricks to make it happens. Here is the tutorial http://css-tricks.com/equal-height-blocks-in-rows/ I am enqueuing JQuery/JS in functions.php as follows : <code> ...
You were really close, I think these fixes should point you in the right direction. I went through and addressed some of your syntax issues and your conditional hooks. Hopefully this will get you rolling in the right direction. <code> // Load 'Working' jQuery add_action( 'init', 'jquery_register' ); // register from go...
JQuery Equal Height in Rows Conflicts Only Works without Registering wp_footer();
wordpress
I'm fighting this quite long already and start to think I'm missing something big. CPT posts could have or not metadata ( <code> _vip_post [0|1] </code> , <code> _thumbnail_id [null|numeric] </code> ). If i query for <code> _thumbnail_id </code> it's ok and works: <code> SELECT SQL_CALC_FOUND_ROWS wp_posts.* FROM wp_po...
Zlatev meta_key is the name of the custom post type, and is a VARCHAR(255) meta_value is the value of the key, and is a longtext With your query you are not ordering by values, but by the name of the field. The query works for _thumbnail_id because you are using LEFT JOIN and the CPT could be null. You could see if you...
mySQL query. ORDER BY meta_key
wordpress
Just I want to create the Project master, there I'll maintain the fields like 'Project type', 'Project Category' and 'Project name'. I've created the table in DB. I thought it is easy to achieve in Custom post type. So I followed the following steps Created the custom post type as 'Project' Created the Meta box and fie...
This Question is kind of vogue but I'll try to answer best to my understanding (mostly from the comments) You can either use the build in post types where the pros are : A built in Admin UI, Easy queries wrapper, and built in table listing, but the cons, as far as i can tell is the unnecessary fields in the posts table...
How to create a master without relying on posts table
wordpress
My website is set up with pages as categories, meaning that if a user publishes without choosing a category, no one can see the post unless they know the specific address. What do I need to hook into in order to check if a category is chosen after the "publish" button is pressed but before the post is published publicl...
Try <code> function wpse46583_save($post_id,$post) { // verify this is not an auto save routine. if ( defined('DOING_AUTOSAVE') &amp;&amp; DOING_AUTOSAVE ) return; //You should check nonces and permissions here if ( !current_user_can( 'edit_page', $post_id ) return; //Get category slugs associated with post $cats =get_...
What to hook into to check a value before a post is published?
wordpress
Is there any way that I can have a website user be able to contact a post author. The website user must not be required to be logged in to the website. I guess a form to email the post author might be the way to go, but it must be simple to use, and avoid spam. Is there such a plugin for wordpress that can handle this?
Ive done this before using both contact form 7 and Grunion Contact Form plugins, when using contact form 7 i created a new tag to send the email to the post author: <code> //contact form 7 author email wpcf7_add_shortcode('author_email', 'wpcf7_expert_email_shortcode_handler', true); function wpcf7_expert_email_shortco...
Visitors Contacting Authors
wordpress