custom-post-types,posts,php,theme-development,post-metaRelated issues-Collection of common programming errors
kaiser
custom-post-types search
The default WordPress search setup isn’t really working for my website’s setup.I have two custom post types (species, glossary) which I’d like to search for, as well as the standard post type.The species post type (which I’ll refer to herein as species profiles) is made up of a number of meta fields, including genus and species (two taxonomic ranks which are used to commonly identify species of fish). The title of a species profile is its scientific name (Genus species) and any non-scientific co
sico87
custom-post-types posts template-tags read-more
I have a custom post type called “Blog”, in my templates I looping over the blog type and doing the following, <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?><section class=”news”><h2 class=”title”><?php echo strtolower(the_title()); ?></h2><h4><?php userphoto_the_author_thumbnail();?> Posted By <?php the_author(); ?> – <?php the_date(“l jS M Y”); ?></h4><p class=”tags”><?php $tags = wp_get_post_tags($post-&
toomanyairmiles
custom-post-types categories pagination 404-error
I’ve recently created several custom post types in a wordpress site, with the code below, they are generating links in the correct form e.g. root/category/id/postname but each link to the full post, pagination or category 404’s. I’ve tried a number of popular solutions, appending /%category%/%post_id%/ to the url structure, rewriting function names but I’m getting nowhere fast.With the wordpress permalink structure set to default e.g. root/?page_id=1257 everything works ok. Any effort to add add
kaiser
custom-post-types wp-query meta-query
I would like to use a meta_key to store multiple values in that key. Thereafter, I would like to filter away posts that do not contain a specific value in the key. In other words, just show posts that do not contain a specific value. This, however, does not seem to be possible. I am writing this question here to see if anyone has come to the same conclusion or if I am just missing something. Here is the code I have used:// The values in key “_no_interest” are: 1,2,3 add_action( ‘pre_get_posts
Mayeenul Islam
custom-post-types post-meta order custom-post-type-archives
I am building a movie archive. For each movie I am filling out the release dates for 3 countries, they’re stored as custom fields (added via Pods)Now, when listing the movies I would like to build an array and loop through each post to check if the fields have values, then compare the values and sort by the first date (oldest or least recent date). If none of the fields have values the posted date should be used for sorting. I am already sorting posts of some categories and their child categorie
Derk-Jan
custom-post-types categories custom-taxonomy
How can I query all the posts from either the custom post type (‘videos’) or with a post category (‘video’) in a loop?I’ve managed to create a query that combines the posts from a custom post type and the normal posts using the code below, but am struggling with achieving the same with a custom post type and a post category.<?php $args = array_merge( $wp_query->query, array( ‘post_type’ => array( ‘post’, ‘videos’, ) ) ); query_posts( $args ); ?> <?php if ( have_posts() ) : wh
Chris_O
custom-post-types custom-taxonomy loop
I am creating a WordPress theme for a record label. One aspect is the video gallery. I created the gallery using a custom post type called ‘videos’. The code below is what I placed in my functions.php file to set up the post type:add_action( ‘init’, ‘create_my_post_types’ );function create_my_post_types() {register_post_type( ‘videos’,array(‘labels’ => array(‘name’ => __( ‘Videos’ ),’singular_name’ => __( ‘Video’ ),’add_new’ => ‘Add New Video’,’edit’ => ‘Edit Video’),’public’ =>
Chris
custom-post-types excerpt
This is proving to be a challenge.I’m trying to make the excerpt a required field, but only when editing/saving a post in a custom post type.The following code makes the excerpt a required field for all posts, but doesn’t take into account for narrowing its affect to a single custom post type.function mandatory_excerpt($data) {$excerpt = $data[‘post_excerpt’];if (empty($excerpt)) {if ($data[‘post_status’] === ‘publish’) {add_filter(‘redirect_post_location’, ‘excerpt_error_message_redirect’, ’99’
s_ha_dum
custom-post-types custom-field
I am trying to order a custom post type called “Teachers” by a field called sort_by. I am not sure why this isn’t working. Here is my code:$args = array( ‘post_type’ => ‘teacher’, ‘posts_per_page’ => 30, ‘order_by’ => ‘sort_by’ ,’order’=>’ASC’ ); $loop = new WP_Query( $args ); while ( $loop->have_posts() ) : $loop->the_post();echo ‘<div class=”entry-content”><h2 class=”teachers”>’;the_title();echo ‘</h2>’;the_excerpt();echo ‘</div>’; endwhile;
Krzysiek Drózdz
custom-post-types wp-query loop
I am currently using WP_Query to loop through a custom post type, and only showing the parent posts like so:<?php$loop = new WP_Query( array(‘post_type’ => ‘programs’,’posts_per_page’ => -1,’post_parent’ => 0) ); ?> <?php while ( $loop->have_posts() ) : $loop->the_post(); ?>loop stuff<?php endwhile; ?>Within each loop, I need to to do another loop, which shows all of the children of that post that is currently being iterated on. The point is to show each post, an
drtanz
posts cron
how can I use Cron to delete posts of a certain post type once they reach a certain limit, like keep maximum 50 posts?The reason is that these posts are being imported automatically periodically, so I want to prevent the DB getting too large, apart from the fact that the older posts won’t be needed.
sico87
custom-post-types posts template-tags read-more
I have a custom post type called “Blog”, in my templates I looping over the blog type and doing the following, <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?><section class=”news”><h2 class=”title”><?php echo strtolower(the_title()); ?></h2><h4><?php userphoto_the_author_thumbnail();?> Posted By <?php the_author(); ?> – <?php the_date(“l jS M Y”); ?></h4><p class=”tags”><?php $tags = wp_get_post_tags($post-&
j-man86
php wordpress count posts
I’m trying to use the following function from http://codex.wordpress.org/Function_Reference/count_user_postsfunction count_user_posts_by_type($userid, $post_type=’post’) {global $wpdb;$where = get_posts_by_author_sql($post_type, TRUE, $userid);$count = $wpdb->get_var( \”SELECT COUNT(*) FROM $wpdb->posts $where\” );return apply_filters(‘get_usernumposts’, $count, $userid); }But I get the following error:Parse error: syntax error, unexpected ‘”‘, expecting T_STRING in …/wp-content/themes/a
Brett
wordpress plugins admin posts
My wordpress admin is showing 0 posts, pages, categories, & tags. However, everything is appearing on the frontend just fine. I’m running wordpress 3.0 and as far as I know no settings have been changed, plugins upgraded, etc since this began happening.Also, when searching for plugins I get the error “An Unexpected HTTP Error occurred during the API request.” I’m assuming this is related to the first problem, but it may not be.Thanks in advance for any help.
Ciprian Popescu
posts merging
I need to be able to merge two or more posts. What is the exact query (or queries) to make this happen?The scenario is multiple recommendations that need to be merged into one. I have already sorted out comments merging and meta merging.Let’s say a user recommends Bill Gates, another one Gates Bill and another one makes a typo and adds Bil Gates. I need to merge these three posts and choose the destination one.UPDATE:What I need is a complete SQL query for deleting a post and all references to t
Brian Fegter
posts functions
I added the following function to the file functions.phpfunction contentGenerator($param) {if($param) {echo “Content true”;} else {echo “Content false”;} }How can I call this function within a specific blog post or page?
Mohammad Ali Akbari
posts attachments order
Here describes get_posts() function. I would like to know what types of order can I pass to get_posts?in WP admin, I can see menu order, title, date, random and …
Nisha_at_Behance
posts plugin-contact-form-7
I am using nice SMCF (Contact Form) want to add a wordpress post list Drop Down menu in “Simple Model Contact form” here what i added on line ‘195’ to try look.$output .= “<div class=’colmsg’><label for=’smcf-message’>*” . __(“Message”, “smcf”) . “: </label><select name=””><option>Post1</option><option>Post2</option><option>Post1</option></select></div><br/>”;after saving / uploading file, it showing Parse error: synt
Pat J
custom-post-types posts loop shortcode
Is it possible to do a if statement in a do_shortcode?<?php echo do_shortcode(“[table width=’500′] ” . if ( have_posts() ) : while ( have_posts() ) : the_post(); the_content(); endwhile; endif; . “[/table]”); ?>It gives me an unexpected T_IF.EDIT: And without the IF statement it gives the post outside the shortcode.
hornj
posts sort
I’m trying to show the latest posts using the get_query_var function. The function filters the posts according to their category. When I’m displaying the posts on the page they appear unsorted although I’ve added the$paged = (get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1;$args=array(‘category__in’=>array( $cat),’order’ => ASC,’caller_get_posts’ => 1,’paged’=>$paged,’orderby’ => date,);query_posts($args);How can I sort properly?
Iain
apache-2.2 php centos suphp
We have a server that’s handling uploads. The memory limit is set at a ridiculously high level in php.ini (800 M).. however we have gd, which is managing the image resizing, but it is dying at about 60M of memory usage (our error log is reporting a fatal error at this stage).From all our Apache config files (CPanel/WHM managed), I can’t find a RLimitMem that’s set anywhere either.I’ve looked as well if there’s any limits set in our kernel, but can’t find anything there as well.Is there somethin
Haresh Vidja
ubuntu php wordpress
I have moved my server data PHP + WordPress and database(mysql) from one server to another server… All things working fine… but some time i got page blank in click submit button.. This problem occures some time ..I didnt get any error or fatal error in errorLog file and not get access entry in accsessLog file also on time of blank page.. Black page issue occurs some time on same taskSo how can I fix this problem..
Scott Pack
apache-2.2 php centos
So the same code works on my Ubuntu server but when I upload it to my dedicated hosting server running CentOS it seems to add an extra prefix of .:/usr/share/pear:/usr/share/php: I tried setting includepath to different things but it just doesn’t work. The file is in a directory called language in the same folder as the file that is including it and I’m using:include dirname(__FILE__).DIRECTORY_SEPARATOR.”language”.DIRECTORY_SEPARATOR.”storage.inc”; include dirname(__FILE__).”/language/language.
mike
php cpanel pdo
Getting this error: Fatal error: Class ‘PDO’ not foundHave these lines in php.ini:extension=pdo.so extension=pdo_sqlite.so extension=sqlite.so extension=pdo_mysql.soThis shows up in php.info()– –enable-pdo=shared’ ‘Have access to whm but there is no “software” tab from which to access easyapatche? Any suggestions??
Mahbubur R Aaman
php centos zend-framework
Shows PHP Fatal Errormain(): Failed opening required ‘Zend/Loader.php’I have installed ZF on /usr/share/phpzf command is working. I can create project and do other works using zf command. But while including the library path then shows the error.Am i missing something?
Passionate Developer
apache-2.2 php
I am getting below errors despite setting memory_limit in php.ini to 64mb:Fatal error: Out of memory (allocated 6291456) (tried to allocate 91284 bytes) in /home/favstayc/public_html/coverbuddy2/cake/libs/configure.php on line 1067What could I change to fix this issue?
BlaM
php iis7 stdout stderr
Okay, this is slowly getting annoying. I’m used to work with Apache Webservers and never had any of these problems. IIS seems to try to be intelligent – or whatever.Here’s my situation: My customer wants a PHP website and it is supposed to run on an Windows IIS webserver.For my development environment I could use my Apache – but just to be sure I want to do it with IIS, too. So I set up a dev-server with Windows Vista, all the latest Updates and installed IIS. Everything fine!I quickly found ins
WerkkreW
apache-2.2 php varnish
We recently migrated our site to a load balanced apache cluster behind varnish. Since that time a very small subset of users is reporting they cannot view any pages. I have narrowed the issue down quite a bit. This issue was not present before the move, the old infrastructure was a single large box.We are on Rackspace Cloud running 8 apache2 instances behind varnish 3.0 all load balanced using Rackspace Cloud load balancers (Zeus) and 2 mysql instances for a total of 10 servers, all linux.Use
Uvais Ibrahim
php php-extensions pecl expect
I got some serious error while installing expect extension in PHP.I ran sudo pecl install channel://pecl.php.net/expect-0.3.1I got error like this while running make,running: make /bin/bash /tmp/pear/temp/pear-build-rootvXp7LZ/expect-0.3.1/libtool –mode=compile cc -I. -I/tmp/pear/temp/expect -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-rootvXp7LZ/expect-0.3.1/include -I/tmp/pear/temp/pear-build-rootvXp7LZ/expect-0.3.1/main -I/tmp/pear/temp/expect -I/usr/include/php5 -I/usr/include/php5/main -I/u
Justin808
php http httpd hostgator
OK, so I’m uploading a 350meg zip file. The file one uploaded is unzipped and the contents are processed. The processing consists of reading in a data file, then copying and thumbnailing images, the adding data to a database. This is all once process start to finish. I can see in the log that the datafile is processed. I can see on the filesystem the thumbnails get created. But then it looks like the whole this starts over from scratch with blank post data and it fails.When I look at the httpd l
Mild Fuzz
toscho
theme-development errors
After installing this videozoom theme i’m getting this error:Parse error: syntax error, unexpected T_ENDWHILE in /home/moviesa1/public_html/test99 dot info/wp-content/themes/videozoom/wpzoom_featured_posts.php on line 1my site: http://test99.info/ <?php$args = array(‘showposts’ => $wpzoom_featured_posts_posts, ‘orderby’ => ‘date’, ‘order’ => ‘DESC’);$featType = $wpzoom_featured_type;if ($featType == ‘Tag’) {$args[‘tag’] = “$wpzoom_featured_slug”;// Breaking tag slug }
user1632018
php theme-development functions jquery hooks
I am developing a theme and I have called jquery along with other JS files from a theme-enqueue.php file. For some reason only the Jquery file that is hosted on googles servers is adding the theme URL into the URL path so it is not loading it and causing other JS files to not load properly. The hook is done properly and it is pointed only to their server and does not include a get_bloginfo or get_template_uri.The file it is adding my theme URL to is:’http://ajax.googleapis.com/ajax/libs/jquery/1
Adam Matan
theme-development
Twitter has just came out with a new web framework called Bootstrap. What’s the right way to use it within a theme?Update: The stylesheet inclusion is simple indeed. I want to know which caveats or compatibility issues I should expect.
user1632018
php theme-development functions customization errors
I have been working on a theme for a few days and when I realized my JS file for my theme customizer wasn’t updating I decided to clear the cookies and cache, and wow that was problematic. As soon as I did that I recieved this error many times, mainly stating the file I am working on(customize.php and the other file it said was pluggable.php:Warning: Cannot modify header information – headers already sent by customize.php After I tried to login I am now receiving this error:Parse error: syntax e
Fulvio
theme-development templates directory variables globals
One WordPress function I happen to use frequently is get_template_directory_uri(). While I tried to minimize or avoid its use where I can, I still happen to have more than one call to this function in certain pages across my theme. Most of the time in a series of href or inside other functions (for which I normally put the URI resulting from get_template_directory_uri() in a $variable – however I still find that I might have to store again that variable in a different php file).I wonder, would i
Gazillion
theme-development search post-type
So I think I might be doing something fundamentally wrong in my WordPress themes since this issue seems to crop up every once in a while and I don’t know why.So basically I created search.php and I use relevanssi to sort my search results by relevancy. When I search for “camera” and do echo get_post_type(); I get “reviews” but if I search for “test” and do echo get_post_type(); I get “articles”. I tried injecting wp_reset_query() just about everywhere to try and see if I was changing it randomly
NoBugs
theme-development themes html
I noticed that the default WP theme uses force_balance_tags for listing posts’ excerpts. This way, it doesn’t cause major html breakage whenever someone writes a post like<div><b>This is an excerpt. <!–more–> and this is more text… </b></div>It will close tags instead of bolding everything, and breaking div.Why doesn’t the normal wordpress page do this by default, in the default theme? That way, broken page content like:</div></div> now text is not w
Tom J Nowell
theme-development plupload
I am developing a theme which needs uploading from front-end. I want to integrate plupload in my theme while keeping in mind that:Uploading will be handled upon form submission, and not from the plupload regular method. This means that I just need the design of plupload, and not the uploading functionality. After selecting the files, when I submit the form (containing selected files and other information), I should be able to grab all the form info (including files info) in the target page. E.g.
JonnyPlow
theme-development pages installation
I’m trying to build a theme which would require specific pages to be included. Is there a way to automatically create pages and assign them to their page templates when a theme is installed?
Mayeenul Islam
custom-post-types post-meta order custom-post-type-archives
I am building a movie archive. For each movie I am filling out the release dates for 3 countries, they’re stored as custom fields (added via Pods)Now, when listing the movies I would like to build an array and loop through each post to check if the fields have values, then compare the values and sort by the first date (oldest or least recent date). If none of the fields have values the posted date should be used for sorting. I am already sorting posts of some categories and their child categorie
toscho
plugin-development database post-meta
When developing plugins that requires data storage, what’s the pros and cons of using one method or another ?The explanation given in the codex is not detailed:Before jumping in with a whole newtable, however, consider if storingyour plugin’s data in WordPress’ PostMeta (a.k.a. Custom Fields) wouldwork. Post Meta is the preferredmethod; use it whenpossible/practical.
toscho
custom-post-types custom-field metabox post-meta single
I have some problems displaying info from my custom meta box in my custom post type single. I’m using Reusable Custom WordPress Meta Boxes by Tammy Hart.I’m able to display the textfields using this:<?php echo get_post_meta($post->ID, $prefix.’hjemmeside’, true); ?>But I can’t get the image to display, instead DEBUG is telling me that it is an “Undefined variable: post_meta_data in”. Currently I’m using this script:<?php$custom_image = $post_meta_data[‘image’][0];echo wp_get_attachme
guiniveretoo
metabox javascript post-meta
I am working on creating custom meta boxes for the back-end of WordPress.I would like to add a metabox with several fields, in my case an image upload and a text input, but with a button that can duplicate both fields.I’ve been following this tutorial and it works fine.But since I want to duplicate multiple fields (as mentioned earlier, the media uploader and text input), the above tutorial does not quite fit. There is only 1 input text used.Now I have found the following source code, which corr
mathiregister
custom-post-types post-meta loop get-template-part
Maybe I simply do not understand what get_template_part() is doing .I have a file called event-list.php that should work as template for other pages and files so all my events (a custom post type) get listed!Inside this event-list.php I have this .<?php $loop = new WP_Query( $args ); while ( $loop->have_posts() ) : $loop->the_post();$wr_event_fields = get_post_custom();$event_date_timestamp = $wr_event_fields[‘_wr_event_date’][0];$event_date = strftime(‘%d.%m.%Y’, $event_date_timestamp)
Bobrov Alexey
post-meta columns
I have some trouble./* Catalog */ function my_post_type_catalog() {register_post_type( ‘catalog’,array( ‘label’ => __(‘Catalog’), ‘public’ => true, ‘show_ui’ => true,’show_in_nav_menus’ => true,’rewrite’ => true,’hierarchical’ => true,’menu_position’ => 5,’supports’ => array(‘title’,’editor’,’thumbnail’,’excerpt’)) );register_taxonomy(‘catalog_cat’, ‘catalog’, array(‘hierarchical’ => true, ‘label’ => ‘Catalog category’, ‘singular_name’ => ‘catalog_category’)); }a
Steve
plugins post-meta facebook excerpt
My site has Facebook social graph meta tags in its page:<meta property=”og:title” content=”First Look at Dwarves from The Hobbit”/> <meta property=”og:description” content=”Movie”/>The only Facebook-related plugin I have installed Facebook Page Publish.Why is it only picking up the category of the post? There are no options to configure the og meta tags of this plugin.UPDATEI now figure I can use the post excerpt as the value for og:description, but whenever I use either of these fu
Sanjib
custom-post-types posts php theme-development post-meta
I’m using the ClassiPress theme as a base for a new theme. If you have worked with classipress, you should know only which post title submit form font end this is display in post title, i am trying to insert city name “which is also submit form font end” after post title..i am trying to cp_get_price($post->ID, ‘cp_city’); then display “Rs. city name” when i use php cp_get_city($post->ID, ‘cp_city’); then display Fatal error: Call to undefined function cp_get_city() in single-ad_listing.php on
Kevin
custom-post-types post-meta save-post
I’m using a custom post type with custom meta fields, but autosave and the “unsaved changes” dialog don’t seem to be triggered for these custom meta fields. Autosave isn’t as important to me as the unsaved changes dialog – is there a way to trigger it?function add_meta_boxes() {add_meta_box(‘places_location’, __(‘Location’), array(&$this, ‘location_box’), ‘place’, ‘normal’, ‘high’); }function location_box($post) {wp_nonce_field(plugin_basename(__FILE__), ‘places_location_nonce’);$lat = get_p
booota
post-meta
I am working on a project which has a functionality of “featured_posts” based on this discussion. I have created a table which lists all the posts. I have a checkbox in each row which upon click submits the for through javascript. when the box is checked, it updates everything and marks the post as featured. As a test, i disabled all the featured posts. Upon unchecking the last checkbox, i got Warning: Invalid argument suppliedwarning. My code is foreach( $_POST[‘list_id’] as $listID ) {if( upda
Web site is in building