plugin-development,posts,attachments,ajax,get-postsRelated issues-Collection of common programming errors
Mild Fuzz
N2Mystic
plugin-development wp-options
I need to make an SQL call to find all records in wp_options matching a select statement. How do I query the table?My script already has these resources called…require_once(‘../../../wp-blog-header.php’); require_once(‘../../../wp-admin/includes/file.php’);
kaiser
plugins plugin-development directory
The taskYou can register add additional Themes directories using register_theme_directory() for your WP installation. Sadly core doesn’t deliver with the same functionality for plugins. We already have MU-Plugin, Drop-Ins, Plugins and Themes. But we need more for a better file organization.Here’s the list of tasks to achieve:Add an additional plugin directory For each plugin directory, a new “tab” is needed as shown here [1] The additional directory would’ve the same functionality as the default
gsc-leticia
plugin-development
I uploaded to a WordPress site (3.3.1) a plugin that works perfectly in my other sites (3.3.1 and 3.4), but when try to activate it I get Fatal Error. When I go to check the plugin’s main file content to do some changes and identify the error I detect that at the end of my code appears some random code from my file repeated.If I edit it and save again another random code is placed at the end of the file again.Any suggestion will be appreciated, even if are suggestions to do more research about i
SoItBegins
plugin-development events wp-cron
I’m developing a plugin and am trying to set up a recurring event for it. However, even putting the function that I’m about to link to an activation hook in my file causes wordpress to throw this error:Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in {server file path} on line 108Here’s the code.function farmdata_loop(){wp_schedule_event(strtotime(‘today 3 AM’), ‘twicedaily’, ‘regen_data’); /* this is line 108 */ }/* a bit later in the file… */function regen_df(){ include_on
Scott B
plugin-development errors
My plugin is freezing the execution of the page at the point where it calls the functions below.I have two problems…1) How can I recode the function so that if there is an error, the plugin does not stop the page from loading, but rather, returns an error message?2) How can I feedback what the error might be? Its just freezing but not outputting the error.function rseo_get_seo($check, $post){//return false;switch ($check){case “h1”: return rseo_doTheParse(‘h1’, $post);case “h2”: return rseo_do
Andre
plugin-development wp-query
I have written a plugin which can store a table of technical specifications for each post (product) in an own database table. For the search function of the site I want to add a custom parameter to the array passed to WP_Query(). I have no clue where to register this custom parameter so that it is handled by the plugin as soon as WP_Query() executes the search.Is there a hook that I can use in the plugin to restrict the posts found by WP_Query() to a certain set matching the specs given? Or do I
songdogtech
plugin-development wpdb table
I am working on creating a table in the DB for a plugin but cannot figure out why the table is not being created.Here’s my code:global $ds_swoons_db_version; $ds_swoons_db_version = ‘1.0’;function ds_swoons_install(){ global $wpdb;$table_name = $wpdb->prefix . “ds_entry_swoons”; if( $wpdb->get_var(“show tables like ‘$table_name'”) != $table_name ):$sql = “CREATE TABLE IF NOT EXISTS ” . $table_name . ” (id mediumint(9) NOT NULL AUTO_INCREMENT,post_id int(9) NOT NULL,user_id (9) NOT NULL,
EkoJr
plugin-development stats wordpress-version repository
When going through your own plugin details and checking the active version downloads. It’s helpful to see which version that webmasters prefer, but I see no details on the subject on WordPress (and on here, yet). I recently had an unexpected change in stats, and I can’t find anything as to what the time frame is. What few that I have found are either closed with little or no response, and/or indirectly related.The active version pie chart can be found on any plugin under Stats.http://wordpress.o
toscho
plugins plugin-development
I am working on a WordPress 3.8 site hosted by Parallels and uploaded via the plex panel.When I want to search, featured, popular, newest favorites a new plugin, I get an error message sayingWarning: An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the support forums. (WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.) in /var/www/vhosts/
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?
gparyani
download attachments yahoo-mail
I use yahoo.com to retrieve my email (I have an att.net account).Lately I have not been able to download attachments. I click Save > Save to my Computer, and they are not (saved to my computer).I had no trouble in the past, so why the sudden change? This happens both at home and at work, so it’s not the machine, it’s the account, or … ???When I click the Save link, it “flashes” but that’s it. Just to be sure the file didn’t “silently/invisibly” download, I search the entire hard drive, and nad
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 …
Metin METE
attachments urls url-rewriting
i want to change the address of the file attachment link to wordpress [example: http:www.sitename.com/category/sub-category/article.html/attachment/image etc.]. i did research on the subject a few days, but could not get any results..looking at the structure of the connection! after “.html”, “/” mark does not look very nice to come. also the “attachment” as the fixing of that section, for WordPress users of different languages are missing a very large. i mean; rewrite.php file links to the autho
jaredwilli
jquery attachments
I think I’m on the right track with what I need to do, at least for doing one of the ways it could be done. I’m not really sure though, I could be way off for all I know.This is part of the code I needed help with last night for resizing the uploaded image files, but now I am trying to figure out how to use the wp_delete_attachment($id) function to delete images attached to the posts.So, I have this jQuery script that adds/ removes extra fields, for uploading more images to attach. For every add
INT
metabox attachments media custom-field
I find it very unnecessary to have an “add image” button that brings me to yet another screen that will let me upload content to my post.Ideally I would like to have a meta box with the option to add images directly in a meta box.I managed to get some functionality by copy the source for the media-upload form and paste it in a meta box. The image I choose gets uploaded, however I doesn’t show any progressbar, and I need to find a way to list attached images below for better overview.Anyone manag
Ogier Schelvis
wp-query ajax attachments media-library media-model
I’ve searched numerous StackOverflow and WordPress Awnsers questions, but I couldn’t find any solution that matches my situation or even remotely points me in the right direction.I have a custom media frame in my plugin where I have pre-selected certain images out of a media library of about 3000 images. However, these pre-selected images aren’t sorted on top of the list by default, which results in you browsing the list for hours to find your selected images. In short I want these to be on top
user63457
plugin-development posts attachments ajax get-posts
I’m developing a plugin and I’m trying to get the url’s from a post’s attachments with ajax. If the user is on a single.php page. After some seconds, I’m sending an Ajax request, getting all the attachments-url from that single post. The script is a php file located in my plugin folder. I found out that normal functions like get_children and get_posts are not working in this script. My php log shows: Call to undefined function get_children() in /Users/tss/WWW/plugin_devel/wp-content/plugins/bgga
rogaroga
php jquery attachments ajax
When i am on the single.php page, i show the first image attachment. then i would like to load the next (and previous) image attachments without reloading the page. so in single.php i started with this to retrieve an array with the images html: <?php $args = array(‘post_type’ => ‘attachment’, ‘post_mime_type’ => ‘image’, ‘order’=> ‘ASC’, ‘numberposts’ => -1, ‘post_status’ => null, ‘post_parent’ => $post->ID ); $attachments = get_posts($args);if ($attachments) {foreach (
dalbaeb
images attachments fatal-error
When users upload very large photos and memory is tight, it seems like WordPress runs out of memory – fails to resize the uploaded photos and does not create the necessary metadata (_wp_attachment_metadata entry in wp_postmeta is not created).The worst part is that the user is never notified. At most I get an “HTTP error” message.Is is possible to somehow add an error message that will warn the user and remove the inconsistent file/database entries? How come this is not standard WP behavior?
Maximus
ajax logging ui
I need to write a handler for server error during user logout. What is a common practice?ajax.post({url: ‘/auth/logout’ }).done(function (response) {switch (response.statusCode) {case 200:{//update UI related to userinformation}case 500:{//what should I do here?}} })Note: The ajax function is reimplementation of $.ajax() with the exception that it always calls done callback (custom promise object is always resolved and never rejected)UPDATE: On server I destroy session and delete auto login cook
kiamlaluno
7 forms ajax
I am writing a form using the Drupal 7 form API. On submitting the form (via AJAX), the following error is displayed:An AJAX HTTP error occurred.HTTP Result Code: 500Debugging information follows.Path: /en/system/ajaxStatusText: Internal Server ErrorResponseText: Recoverable fatal error: Argument 1 passed to drupal_array_nested_key_exists() must be an array, null given, called in /drupal7/includes/form.inc on line 1986 and defined in drupal_array_nested_key_exists() (line 6296 of /drupal7/includ
rborgeous
ajax
I have installed editableviews and upon adding the formatter to my content-type display, I receive the following error when saving the edits to my field. Upon reload of the page it seems that the changes were made it just results in the following error upon submission:An AJAX HTTP error occurred.HTTP Result Code:500Debugging information follows.StatusText: Service unavailable (with message)ResponseText: Recoverable fatal error: Argument 1 passed todrupal array_get_nested_value() must be of the t
laxman
php jquery ajax wordpress woocommerce
I am getting catchable fatal error in bellissima themeforest woocommerce theme.http://www.pursesgalore.com.au/ can anyone help on this?Code:if(!$dst_h) ://can’t resize, so return original url$img_url = $url;$dst_w = $orig_w;$dst_h = $orig_h;————————–line number 1040 ———————–else ://else check if cache existsif(file_exists($destfilename) && getimagesize($destfilename)) {$img_url = “{$upload_url}{$dst_rel_path}-{$suffix}.{$ext}”;} Error: Catchable fatal erro
Fran Verona
php javascript jquery ajax
I have a PHP file with the following code:<html><head><!– HEAD –><?php require_once ‘Language.php’; ?></head><body><script type=”text/javascript”>$.get(‘step2.php’,function(data){// Do something});</script></body> </html>As you can see, I’m trying to load some content via Ajax call. The problem is that step2.php contains some PHP code:<div class=”step-content table-bordered”><h3><?php echo $Lang->get(‘create_s2_title
Tim Post
php ajax
Quite simply, I want my javascript to be able to react to a fatal 500 error caused by PHP, appropriately to the error.My goal is simply to collect the fatal error message that the script produced, so I can show it on the client side.Is this in any way possible?EDIT: cleaned up the question, in case it gets, by chance, it gets searched.
Tom
jquery ajax joomla joomla2.5
Still having problems figuring out how to use Ajax and the Joomla framework together. I’ve created a Joomla component which I can access with:index.php?option=com_mycomponentI’m using Jquery with Ajax in components/com_mycomponent/views/mycomponent/tmpl/default.php:<?php // No direct access to this file defined(‘_JEXEC’) or die(‘Restricted access’); ?> <html> <head><title>Ajax with jQuery Example</title><script language=”javascript” type=”text/javascript” src=”ht
StuckAtWork
php ajax error-handling iis-7.5
I’d like to see any PHP errors that are occuring, ie the “Expected ; on line 5 of myfile.php” sort of thing. Unfortunately, I cannot seem to figure out how to see this information.I’ve set E_ALL, display_errors ON, friendly error messages are turned off, IIS is set to pass-through on errors, what am I missing?Syntax errors used to show up as stated above on any page; they no longer do. We moved the server to a localhost for development, and I guess didn’t mimic exactly the server config. Now I’m
NathaliaZeed
php mysql ajax mysqli
I’m battling to replace the mysql_results to mysqli. Could someone help. All I need is to correct ‘mysqli_result($result, ‘0’, ‘theurl’)’ in my code below. It worked when everything was written using mysql functions. But after I converted everything to mysqli, the mysql_results conversion seems to not be working.When it worked: echo(mysql_num_rows($query) !== 0) ? mysql_result($query, 0, ‘theurl’) : ‘None’;When I run this my current code I get an error: Fatal error: Call to a member function da
novicePrgrmr
java javascript ajax json jsp
I am sorry to ask this but i’ve been working on this for hours and I can’t figure it out on my own. I have to use json for part of a project and I was able to get it to work but now it’s not returning it back to the right jsp but instead just displaying the json jsp. I am pretty sure it is how I am receiving the json.here are screen shots of what is happening:this is the jsp that I need to use ajax on, I am wanting to populate the second dropdown using ajax:this is what is happening instead, (it
janoChen
query-posts wp-query get-posts
Right now, I’m using get_posts to retrieve cusstom posts types with a custom taxonomy assigned to it in order to generate static content like this:<?php /*** Template Name: Front Page* @package WordPress* @subpackage Prominent* @since Prominent 1.0*/ get_header(); ?> <div class=”shadow-top”><!– Shadow at the top of the slider –> </div> <div id=”intro”><div class=”container”><div id=”slider-wrapper”><div id=”slider”><?php // Create custom loop
Andy
custom-taxonomy get-posts
Custom Post Type = ‘projects’ with a Hierarchical Taxonomy = ‘projects_category’projects – big-corporates — company one —- first project 1 —- second project 1 —- third project 1 — company two —- first project 2 —- second project 2 — company three —- first project 3 —- second project 3 —- third project 3 – small-businesses — company four —- first project 4 —- etc… — company five — company sixBelow I get a list of all projects listed in ‘projects_category’ under ‘big-co
midCat
categories query-posts page-template get-posts
I’m a C programmer, konw little about PHP. I built a Blog with wordpress.Yestoday, I try to create the page www.abc.com/server, this page would list all posts which belong to server category.I found some useful information in wordpress document and GoogleI created a template like this:<?php/** Template name: list_catetory*/ ?><?php get_header(); ?>…<?php query_posts( ‘cat_name = $pagename’ );if(have_posts()) : while(have_posts()) : the_post(); ?><div class=”post-list” id=
Johannes Pille
custom-post-types wp-query shortcode get-posts recent-posts
I’m not a coder so I may have done some “coding” crimes, apologies. I’ve bought a theme who has shortcodes for last posts but not for last “custom post type”. So I tried to create last “custom post type” function modifying the Last post function provided. Last post funtion:function get_custom_posts( $params ) { extract( shortcode_atts( array (‘number’ => ‘1’,’excerpt’ => 290,’readmore’ => ‘no’,’readmoretext’ => ‘Read more’ ), $params ) );//$latest_posts = get_posts( ‘category=0&n
user63457
plugin-development posts attachments ajax get-posts
I’m developing a plugin and I’m trying to get the url’s from a post’s attachments with ajax. If the user is on a single.php page. After some seconds, I’m sending an Ajax request, getting all the attachments-url from that single post. The script is a php file located in my plugin folder. I found out that normal functions like get_children and get_posts are not working in this script. My php log shows: Call to undefined function get_children() in /Users/tss/WWW/plugin_devel/wp-content/plugins/bgga
Mohamed Gaber
wp-query get-posts dashboard
I want to ask if there is a hook for executing php inside the admin area, my problem is I’m trying to do the get_posts wordpress function inside a popup frame using the thickbox jQuery plugin, using an anchor, and I linked this anchor to a page contains my codeI do the main function in the functions.php file which isfunction fetch_all_companies() { $companies_args = array(‘numberposts’ => -1,’orderby’ => ‘post_date’,’order’ => ‘DESC’,’post_type’ => ‘company’,’post_status’ => ‘publ
jilseego
get-posts
The exact error is: Call to undefined function get_userdata() in /wp-includes/query.php on line 3567I am using get_posts() in my plugin, which in turn uses setup_postdata() wherein get_userdata() is executed. I have no clue what’s going on. I looked at query.php and it looks like get_userdata() is a global function, it shouldn’t have any problem accessing it right?MORE DETAIL: My plugin is in a class form. This is just the basic structure. There are multiple functions in the actual code actually
Web site is in building