lukekfreeman
Forum Replies Created
-
Forum: Themes and Templates
In reply to: Using Get Pages for Page ListHi all,
I’ve managed to make get pages work for listing a page, however, if there are more than one child page at the same level and one of them has children of its own it will cut off. E.g.:
+ Level one
-+ Level two
-+ Level two
–+ Level three
—+ Level four
+ Level threeHere’s the code. Any help is much appreciated:
<?php $pages = get_pages('child_of='.$post->ID.'&sort_column=post_date&sort_order=DESC'); $count = 0; $ulcount = 0; $previous_previous_parent = 0; $previous_parent = $page->post_parent; $previous_page = $page->ID; foreach($pages as $page) { $parent_page = $page->post_parent; if($previous_parent != $parent_page && $previous_page == $parent_page) { echo '<ul>'; echo $ulcount++; } if($previous_parent != $parent_page && $previous_page != $parent_page) while($ulcount > 0) { echo '</ul>'; echo $ulcount--; } $content = $page->post_content; if(!$content) continue; $count++; $content = apply_filters('the_content', $content); ?> <?php if($ulcount == 0) echo '<hr />'; ?><li> <a href="<?php echo get_page_link($page->ID) ?>"><?php echo $page->post_title ?></a> by <!--<?php echo get_userdata($page->post_author)->user_url; ?>--> <?php echo get_userdata($page->post_author)->display_name; ?> <?php if (get_post_custom_values('Character', $page->ID)==TRUE) { $mykey_values = get_post_custom_values('Character', $page->ID); foreach ( $mykey_values as $key => $value ) { echo $value; echo ', '; } } ?><?php echo mysql2date('D, M j, Y H:i a', $page->post_date); ?></li> <?php $previous_previous_parent = $previous_parent; $previous_parent = $page->post_parent; $previous_page = $page->ID; } ?>
Forum: Themes and Templates
In reply to: Default attributes create pageI figured it out, but still can’t get Custom Fields to work.
Here it is:
Title: <input name="reply_title" type="text" value="" /> <br /> <span style="display:none">Character:<input type="text" name="reply_character" value="" /><br /></span> Reply:<br /> <textarea name="reply_content" id="reply_content" class="theEditor" type="text" tabindex="1" rows="15" cols="90" /></textarea> <br /> <input type="hidden" name="reply_author" value="<?php echo $reply_login; ?>" /> Password: <input name="reply_password" type="password" /> <br /> <input name="reply_parent" type="hidden" value="<?php the_ID(); ?>" /> <br /> <input type="submit" value="Post it!"/>
And then the replyprocess.php
<?php include_once( 'wp-includes/class-IXR.php'); $method_name = "wp.newPage"; $rpc_url = "https://www.wheeloftimerp.net/xmlrpc.php"; $blog_id = 1; $username = $_POST['reply_author']; $password = $_POST['reply_password']; $publish = true; $custom_fields = array( "key" => "Character", "value" => $_POST['reply_character'] ); $post = array( "title" => $_POST['reply_title'], "description" => $_POST['reply_content'], "wp_page_parent_id" => $_POST['reply_parent'], "custom_fields" => $custom_fields ); $rpc = new IXR_Client( $rpc_url ); $status = $rpc->query( $method_name, $blog_id, $username, $password, $post, $publish ); if( !$status ) { print "Error in RPC request\n"; print_r( $rpc ); exit; } print_r( $rpc->getResponse( ) ); print "\n"; ?>
Forum: Installing WordPress
In reply to: tinyMCE / the_editor() in a pageThis doesn’t work for calling it from the wordpress front end. I just get call to undefined function when I use this code
<?php wp_tiny_mce( false , // true makes the editor "teeny" array( "editor_selector" => "reply_content" ) ); ?>
from within a wordpress page (trying to get rich text replies).
Forum: Fixing WordPress
In reply to: Add Custom Fields To A Post Using XML-RPCHi, I’m using this code to post using xmlrcp but it doesn’t seem to be parsing the cusom_fields.
Any help would be much appreciated, thanks!
<?php include_once( 'wp-includes/class-IXR.php'); $method_name = "wp.newPage"; $rpc_url = "https://www.wheeloftimerp.net/xmlrpc.php"; $blog_id = 1; $username = $_POST['reply_author']; $password = $_POST['reply_password']; $publish = true; $custom_fields = array( "key" => "Character", "value" => $_POST['reply_character'] ); $post = array( "title" => $_POST['reply_title'], "description" => $_POST['reply_content'], "wp_page_parent_id" => $_POST['reply_parent'], "custom_fields" => $custom_fields ); $rpc = new IXR_Client( $rpc_url ); $status = $rpc->query( $method_name, $blog_id, $username, $password, $post, $publish ); if( !$status ) { print "Error in RPC request\n"; print_r( $rpc ); exit; } print_r( $rpc->getResponse( ) ); print "\n"; ?>
Forum: Themes and Templates
In reply to: Using Get Pages for Page ListAh, I can’t believe I was missing that for hours!
Thanks so much!
Absolute legend!Forum: Installing WordPress
In reply to: the_content not working at allActually, correction. Neither the_content or the_excerpt are working. The only thing pulling content is the_excerpt_reloaded (i tried disabling that and I get no content whatsover).