Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
template: Output of the User name - get_page_usr()?
#6
ChriS Wrote:I'm only able to hack some obvious things. Undecided Maybe I will try; but I prefer to use the core or a well developed plugin. ;-)

If Carlos solution won't be sufficient, place below code in functions.php file (same directory as template.php) and call it function from template
Code:
function show_author($id){
    $file = "data/pages/". $id .".xml";
    if ( file_exists($file) ){
        $data_index = getXML($file);
        $author = 'stripslashes(html_entity_decode($data_index->user, ENT_QUOTES, 'UTF-8') );
    }else{
        $author="";
    }
    
    return $author;
}


and call it function from template below the function showing page's content (it depends of course on where you want to place author's name)

Code:
<?php echo show_author(return_page_slug()); ?>

Function will show empty string if page does not exist Wink

ps. I didn't test this, but the code should work.
Addons: blue business theme, Online Visitors, Notepad
Reply


Messages In This Thread
template: Output of the User name - get_page_usr()? - by yojoe - 2012-02-26, 10:00:00



Users browsing this thread: 1 Guest(s)