Syntax for a function in order to get post’s title in JSON encoded response [closed]

You want to add the title to the response, not replace the response with the title. Like this: <?php function get_all_images($post_id=0, $size=”bigger”, $attributes=””) { $post_id = $_POST[‘post_id’]; if ($post_id<1) $postid = get_the_ID(); if ($images = get_children(array( ‘post_parent’ => $post_id, ‘post_type’ => ‘attachment’, ‘numberposts’ => -1, ‘orderby’ => ‘menu_order’, ‘post_mime_type’ => ‘image’,))) $title = get_the_title($post_id); $response=”<h2 … Read more

using Ajax: call to undefined function get_option

Basically, if you’re going to be making calls to WordPress functions, then you should be in the WordPress environment, which means that you should not be calling your own files to begin with, but should implement your AJAX call within a WordPress hook. Read up on this: http://codex.wordpress.org/AJAX_in_Plugins That article describes how to implement AJAX … Read more

Ajax call does not work for this custom code

Instead of doing: data: {action: ‘performers’, catname: catname} Try: data: ‘action=performers&catname=”+catname; You may also want to define “catname” globally, i am not sure if scope is an issue with your ajax handler but this could be why it is not being set. As an example try to alert catname within the ajax handler above cache=false; … Read more

Adding a time stamp on post view

You are nearly there, I’d say. I am sure there are many ways to do this. If it were me, I’d build a ‘nested’ array for this. Something like… array( ‘timestamp-1’ = array( ‘message’ => ‘Updated post1’, ‘message’ => ‘Updated post1’ ), ‘timestamp-2’ = array( ‘message’ => ‘Updated post3’, ‘message’ => ‘Updated post4’, ‘message’ => … Read more

ajax page template

As it seems, it’s an easier way, using get_template_part and some php magic. What you do is get the page name from post_metadata filter the filename without the extension and add it to get_template_part. Of course all your data must conform a predefined variable (or just pass the id to the template) because you have … Read more