A listing of Work Log entries (posts)
‘, $post_content );
$lines = array();
if ( count( $content ) > 1 ) {
$content = str_ireplace( array( ‘
‘, ‘)
‘ ), ”, $content[1] );
$one_line = preg_replace( ‘/\s+/’, ‘ ‘, $content );
$one_line = preg_replace( ‘/.*Array \( (.*)\)/’, ‘$1’, $one_line );
preg_match_all( ‘/\[([^\]]+)\] =\>\; ([^\[]+)/’, $one_line, $matches );
if ( count( $matches ) > 1 )
$all_values = array_combine( array_map(‘trim’, $matches[1]), array_map(‘trim’, $matches[2]) );
$lines = array_filter( explode( “\n”, $content ) );
}
$var_map = array(
‘AUTHOR’ => ‘_feedback_author’,
‘AUTHOR EMAIL’ => ‘_feedback_author_email’,
‘AUTHOR URL’ => ‘_feedback_author_url’,
‘SUBJECT’ => ‘_feedback_subject’,
‘IP’ => ‘_feedback_ip’
);
$fields = array();
foreach( $lines as $line ) {
$vars = explode( ‘: ‘, $line, 2 );
if ( !empty( $vars ) ) {
if ( isset( $var_map[$vars[0]] ) ) {
$fields[$var_map[$vars[0]]] = self::strip_tags( trim( $vars[1] ) );
}
}
}
$fields[‘_feedback_all_fields’] = $all_values;
$post_fields[$post_id] = $fields;
return $fields;
}
//******************************************************************
global $wpdb;
$poststable = $wpdb->prefix . “posts”;
$postmetatable = $wpdb->prefix . “postmeta”;
$result = $wpdb->get_results ( ”
SELECT *
FROM $wpdb->posts p
WHERE p.post_type = ‘feedback’ and p.id = ‘1007’
order by p.post_date
” );
if (! $result) {
$Error = $wpdb->print_error();
die(“The following error was found: $Error”);
} else {
foreach ( $result as $page )
{
echo $page->ID.’ ‘.$page->post_title.’
‘;
echo ‘———————–this is the post_content————————
‘;
echo $page->post_content.’
‘;
echo ‘———————–Trying————————
‘;
$fields = parse_fields_from_content( ‘1007’ );
$all_fields = array();
if ( isset( $fields[‘_feedback_all_fields’] ) )
$all_fields = $fields[‘_feedback_all_fields’];
print_r($all_fields);
echo ‘———————–That looks like an array————————
‘;
echo ‘———————–can I access the [2_Leader Email] element?
‘;
echo $page->post_content[‘2_Leader Email’].’
‘;
echo ‘———————–apparently not————————
‘;
$content = $page->post_content;
$uc = unserialize($content);
//echo $content->display( ‘name’ );
//$content = apply_filters( ‘the_content’, $content );
//$echo $content;
echo $content;
echo ‘——————That is the content again ———–
‘;
echo $content[‘1_Leader Name’].’
‘;
echo $content[‘2_Leader Email’].’
‘;
echo $content[‘3_Project Description’].’
‘;
echo $content[0].’
‘;
echo $content[1].’
‘;
echo $content[2].’
‘;
echo $content[3].’
‘;
echo $content[4].’
‘;
//echo “Hello {$content[‘1_leader Name’]}!”;
echo ‘
——————+++++++++++++++2222++++++++++++++
‘;
//print_r($content);
//$arr = EXPLODE($content);
//$array_keys = array_keys($arr);
echo $uc[‘3_Project Description’].’
‘;
echo ‘
——————+++++++++++++++3333++++++++++++++
‘;
print_r($uc);
echo ‘
——————+++++++++++++++4444++++++++++++++
‘;
$after_more = explode( ‘‘, $post->post_content );
if( $after_more[1] ) {
$content = $after_more[1];
} else {
$content = get_the_content();
}
$trimmed_content = wp_trim_words( $content, 50, NULL );
echo $trimmed_content;
}
}
?>