%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /var/www/pn/beta/64801_wp-content/themes/intosai/
Upload File :
Create Path :
Current File : //var/www/pn/beta/64801_wp-content/themes/intosai/functions.php

<?php
/**
 * Sage includes
 *
 * The $sage_includes array determines the code library included in your theme.
 * Add or remove files to the array as needed. Supports child theme overrides.
 *
 * Please note that missing files will produce a fatal error.
 *
 * @link https://github.com/roots/sage/pull/1042
 */
$sage_includes = [
    'lib/assets.php',           // Scripts and stylesheets
    'lib/setup.php',            // Theme setup
    'lib/titles.php',           // Page titles
    'lib/wrapper.php',          // Theme wrapper class
    'lib/customizer.php',       // Theme customizer & Scripts and stylesheets
    'lib/project_filter.php',    // AJAX Function to filter trought projects
    'lib/display_sai.php'      // AJAX Function to get info on SAI
];

foreach ($sage_includes as $file) {
    if (!$filepath = locate_template($file)) {
        trigger_error(sprintf(__('Error locating %s for inclusion', 'sage'), $file), E_USER_ERROR);
    }
    require_once $filepath;
}
unset($file, $filepath);

/*------------------------------------*\
    UTÖKAD SÄKERHET
\*------------------------------------*/
add_filter('xmlrpc_enabled', '__return_false');

/*------------------------------------*\
    CUSTOM VAR_DUMP
\*------------------------------------*/
function dump($var) {
    echo "<pre style='background:#eee; padding: 15px;'>";
        var_dump($var);
    echo "</pre>";
}

/*------------------------------------*\
    TAR BORT KOMMENTARER FRÅN ADMIN
\*------------------------------------*/
// Removes from admin menu
add_action( 'admin_menu', 'my_remove_admin_menus' );
function my_remove_admin_menus() {
    remove_menu_page( 'edit-comments.php' );
}
// Removes from post and pages
add_action('init', 'remove_comment_support', 100);

function remove_comment_support() {
    remove_post_type_support( 'post', 'comments' );
    remove_post_type_support( 'page', 'comments' );
}
// Removes from admin bar
function mytheme_admin_bar_render() {
    global $wp_admin_bar;
    $wp_admin_bar->remove_menu('comments');
}
add_action( 'wp_before_admin_bar_render', 'mytheme_admin_bar_render' );

/*------------------------------------*\
    PAGINATION
\*------------------------------------*/
add_action('init' , 'pagination');
function pagination()
{
    global $wp_query;
    $big = 999999999;
    echo paginate_links(array(
        'base' => str_replace($big, '%#%', get_pagenum_link($big)),
        'format' => '?paged=%#%',
        'current' => max(1, get_query_var('paged')),
        'total' => $wp_query->max_num_pages
    ));
}

// Lägg till en ändelse efter de retunerade orden på the_excerpt
//*********************************************************************
function custom_excerpt($limit) {
    $excerpt = explode(' ', get_the_excerpt(), $limit);
    if (count($excerpt) >= $limit) {
        array_pop($excerpt);
        $excerpt = implode(" ", $excerpt) . '...';
    } else {
        $excerpt = implode(" ", $excerpt);
    }

    $excerpt = preg_replace('`\[[^\]]*\]`', '', $excerpt);
    return $excerpt;
}

/*------------------------------------*\
   Shortcode countrydropdown
\*------------------------------------*/

    //Variabel för att hämta värde från taxonomin.

    function countrydropdown_func() {

        $wdi = get_terms(array(
            'taxonomy' => 'wdi',
            'hide_empty' => false,
        ));

        ob_start();
        ?>
            <select class='dropdown'>
                <option style='display:none;'>-Choose a country-</option>

                <?php foreach ($wdi as $region) {

                    $regID = $region->term_id;
                    $regNamn = $region->name;
                    $classification = get_field('economic_classification', 'wdi_'.$regID);

                    if ($classification != 'High Income Countries') {
                        echo "<option value='{$regNamn}'>{$regNamn}</option>";
                    }
                } ?>
            </select>
        <?php
        $content = ob_get_clean();
        return $content;
    }

    add_shortcode('countrydropdown', 'countrydropdown_func');

/*------------------------------------*\
   WooCommerce
\*------------------------------------*/
/*--- Deklarera WooCommerce support samt lägg till de funktioner som behövs ---*/
// add_action( 'after_setup_theme', 'nobox_sage_woo_setup' );
// function nobox_sage_woo_setup() {
//     add_theme_support( 'woocommerce' );
//     add_theme_support( 'wc-product-gallery-zoom' );
//     add_theme_support( 'wc-product-gallery-lightbox' );
//     add_theme_support( 'wc-product-gallery-slider' );
// }

/*----------------------------------------------------*\
   REDIRECT UNSUCCESSFULL LOGIN ATEMPTS FROM FRONTENT
\*----------------------------------------------------*/
add_action( 'wp_login_failed', 'my_front_end_login_fail' );

function my_front_end_login_fail( $username ) {
   $referrer = $_SERVER['HTTP_REFERER'];
   if ( !empty($referrer) && !strstr($referrer,'wp-login') && !strstr($referrer,'wp-admin') ) {
      wp_redirect( $referrer . '?login=failed' );
      exit;
   }
}

/*------------------------------------*\
   KONVERT FILESIZE FROM BYTES TO MORE APPROPRIATE NUMBERS
\*------------------------------------*/
function formatSizeUnits($bytes){
    if ($bytes >= 1073741824){
        $bytes = number_format($bytes / 1073741824, 2) . ' GB';
    }elseif ($bytes >= 1048576){
        $bytes = number_format($bytes / 1048576, 2) . ' MB';
    }elseif ($bytes >= 1024){
        $bytes = number_format($bytes / 1024, 2) . ' KB';
    }elseif ($bytes > 1){
        $bytes = $bytes . ' bytes';
    }elseif ($bytes == 1){
        $bytes = $bytes . ' byte';
    }else{
        $bytes = '0 bytes';
    }
    return $bytes;
}

/*------------------------------------*\
   SHOW WEATHER THE USER IS ACTIVE OR NOT IN THE LISTING
\*------------------------------------*/
add_filter('manage_users_columns', 'nobox_active_user');
function nobox_active_user($columns) {
    $columns['user_status'] = 'Active User';
    return $columns;
}

add_action('manage_users_custom_column',  'nobox_show_user_status', 10, 3);
function nobox_show_user_status($value, $column_name, $user_id) {
    $user = get_userdata( $user_id );
	if('user_status' == $column_name ){
        if($user->roles[0] == 'project_manager'){
    		$value = get_field('active_user', 'user_'.$user_id);
            if($value == ''){
                $value = '<span style="color:#b70808;font-weight:700;">no</span>';
            }elseif($value == 'yes'){
                $value = '<span style="color:#30bd0c;font-weight:700;">yes</span>';
            }elseif($value == 'no'){
                $value = '<span style="color:#b70808;font-weight:700;">no</span>';
            }
        }else{
            $value = '<span style="color:#30bd0c;font-weight:700;">yes</span>';
        }
    }
    return $value;
}

/*----------------------------------------*\
   SHOW/HIDE STUFF FOR PROJECT MANAGERS
\*----------------------------------------*/

/*-- REMOVE THE ADMIN BAR FOR NON ADMIN USERS --*/
add_action('after_setup_theme', 'remove_admin_bar');
function remove_admin_bar() {
    if (!current_user_can('administrator') && !is_admin()) {
      show_admin_bar(false);
    }
}

/*-- REDIRECT ALL NON ADMIN USERS FROM THE DASHBOARD TO THE FRONT PAGE --*/
add_action( 'init', 'blockusers_init' );
function blockusers_init() {
    if ( is_admin() && ! current_user_can( 'administrator' ) &&
    ! ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) {
        wp_redirect( home_url() );
        exit;
    }
}

/*----------------------------------------------------*\
   EMAIL PROJECT MANAGERS IF THEIR STATUS IS ALTERED
\*----------------------------------------------------*/
function project_manager_uppdate($user_id, $old_user_data){
    $userData   = get_userdata($user_id);
    $userRole   = $userData->roles[0];
    $userInfo   = get_user_by('ID', $user_id);

    if($userRole == 'project_manager'){
        $old_user_data  =   get_transient( 'old_user_data_'.$user_id);
        $userStatus     =   get_field('active_user', 'user_'.$user_id);

        $userEmail      =   $userInfo->user_email;
        $encryptEmail   =   md5($userEmail);

        if($userStatus != $old_user_data){
            if($userStatus != 'yes'){
                delete_transient( 'old_user_data_' . $user_id );
                header("Location: /smtp_wp_mailer.php?user_deactivated&user={$user_id}&key={$encryptEmail}");
                exit;
            }

            if($userStatus == 'yes'){
                delete_transient( 'old_user_data_' . $user_id );
                header("Location: /smtp_wp_mailer.php?user_activated&user={$user_id}&key={$encryptEmail}");
                exit;
            }
        }
    }
}
add_action('profile_update', 'project_manager_uppdate', 10, 2);

// TEMPORARILY SAVE THE OLD USER DATA FOR CROSSREFFERENCE UPON USER UPDATE
function old_user_data_transient($user_id){
    $user_data = get_userdata( $user_id->ID );
    $user_meta = get_user_meta( $user_id->ID);

    $active = get_field('active_user', 'user_'.$user_id->ID);

    // Save transient data for 1 hour
    set_transient( 'old_user_data_' . $user_id->ID, $active, 60 * 60 );
}
add_action('show_user_profile', 'old_user_data_transient',10, 1);
add_action('edit_user_profile', 'old_user_data_transient',10, 1);

// CREATE USER ACTIVATION/DEACTIVATION MESSAGES
function user_activated_success() {
    ?>
    <div class="notice notice-success is-dismissible">
        <p>The user was successfully activated</p>
    </div>
    <?php
}
function user_activated_error() {
    ?>
    <div class="notice notice-error is-dismissible">
        <p>An error occured and the user was not activated. Please try again.</p>
    </div>
    <?php
}

if(isset($_GET['user_activated'])){ add_action('admin_notices', 'user_activated_success' ); }           // Activatin success
if(isset($_GET['user_activation_failed'])){ add_action('admin_notices', 'user_activated_error' ); }     // Activatin error

function user_deactivated_success() {
    ?>
    <div class="notice notice-success is-dismissible">
        <p>The user was successfully deactivated</p>
    </div>
    <?php
}
function user_deactivated_error() {
    ?>
    <div class="notice notice-error is-dismissible">
        <p>An error occured and the user was not deactivated. Please try again.</p>
    </div>
    <?php
}

if(isset($_GET['user_deactivated'])){ add_action('admin_notices', 'user_deactivated_success' ); }           // Deactivatin success
if(isset($_GET['user_deactivation_failed'])){ add_action('admin_notices', 'user_deactivated_error' ); }     // Deactivatin error

/*----------------------------------------------------*\
   ADD FILTER ONCE FUNCTION
\*----------------------------------------------------*/
function add_action_once( $tag, $function_to_add, $priority = 10, $accepted_args = 1 ) {
	global $_gambitFiltersRan;

	if ( ! isset( $_gambitFiltersRan ) ) {
		$_gambitFiltersRan = array();
	}

	// Since references to $this produces a unique id, just use the class for identification purposes
	$idxFunc = $function_to_add;
	if ( is_array( $function_to_add ) ) {
		$idxFunc[0] = get_class( $function_to_add[0] );
	}
	$idx = _wp_filter_build_unique_id( $tag, $idxFunc, $priority );

	if ( ! in_array( $idx, $_gambitFiltersRan ) ) {
		add_action( $tag, $function_to_add, $priority, $accepted_args );
	}

	$_gambitFiltersRan[] = $idx;

	return true;
}
/*----------------------------------------------------*\
   MERGE PROJECT REVISION WITH MAIN PROJECT
\*----------------------------------------------------*/
function project_merge($post_id){
    remove_action('publish_project', 'project_publish');

    if(did_action('publish_project_revisions') === 1 && did_action('publish_project') === 0 && did_action('publish_post') === 0 && did_action('publish') === 0){
        if(!(wp_is_post_revision($post_id) || wp_is_post_autosave($post_id))) {

        	$post_type = get_post_type($post_id);

            if('project_revisions' != $post_type) : //Check if the posttype is Project revision. If not, do nothing.
                return;
            endif;

            $revision = $post_id;
            $status = get_post_status($revision);

            //If the post us updated to be published
            if($status = 'publish'){
                //Get all the content from the revision
                $project_to_update = get_field('revision_for_id', $revision);

                $content_post = get_post($revision);
                $content = $content_post->post_content;
                $content = apply_filters('the_content', $content);
                $content = str_replace(']]>', ']]&gt;', $content);
                $project_content = $content;

                $postStatus                 = get_field('publish_status', $revision);
                $projectName                = get_the_title($revision);
                $projectStatus              = get_field('project_status', $revision);
                $projectBenLevel            = get_field('beneficiary_level', $revision);
                $projectINTOSAIRegion       = get_field('intosai_region', $revision);
                $projectDesc                = $project_content;
                $projectInit                = get_field('project_initiated', $revision);
                $projectFurtherLink         = get_field('further_info', $revision);
                $projectCPBenSaiReCom       = get_field('cp_ben-sai_region_committee', $revision);
                $projectFunding             = get_field('source_funding', $revision);
                $projectFundingCustom       = get_field('source_funding_custom', $revision);
                $projectCPDonor             = get_field('cp_donor', $revision);
                $projectImpAge              = get_field('imp_agencys', $revision);
                $projectCPImpPart           = get_field('cp_imp-partners', $revision);
                $projectFrom                = get_field('duration_from', $revision);
                $projectTo                  = get_field('duration_to', $revision);
                $projectBudget              = get_field('total_budget', $revision);
                $projectSupType             = get_field('type_of_support', $revision);
                $projectSupModal            = get_field('support_modality', $revision);
                $projectSupCats             = get_field('support_cats_covered', $revision);
                $projectSupBased            = get_field('support_based_on', $revision);
                $projectLinkedProj          = get_field('project_connections', $revision);
                $projectOtherInfo           = get_field('other_info', $revision);
                $publishStatus              = get_field('publish_status', $revision);
                $projectCountsySAI          = get_field('country_sai', $revision);
                $projectDACCIC              = get_field('dac_income_class', $revision);
                $draftCreated               = get_field('draft_creation', $revision);

                $terms = wp_get_post_terms($revision, 'wdi');
                $selected_terms = array();
                foreach($terms as $selected){
                    $selectedID = $selected->term_id;
                    array_push($selected_terms, $selectedID);
                }

                $allowedTags = '<br><strong><b><em><i><ul><li>';

                $project = array(
                    'ID'                =>      $project_to_update,
                    'post_type'         =>      'project',
                    'post_status'       =>      'publish',
                    'post_title'        =>      strip_tags($projectName),
                    'post_content'      =>      strip_tags($projectDesc, $allowedTags),
                    'tax_input'    => array(
                        'wdi'   =>  $selected_terms
                    ),
                    'meta_input'        =>      array(
                        'project_status'                        =>  $projectStatus,
                        'beneficiary_level'                     =>  $projectBenLevel,
                        'intosai_region'                        =>  $projectINTOSAIRegion,
                        'project_initiated'                     =>  $projectInit,
                        'further_info'                          =>  $projectFurtherLink,
                        'cp_ben-sai_region_committee'           =>  $projectCPBenSaiReCom,
                        'source_funding'                        =>  $projectFunding,
                        'source_funding_custom'                 =>  $projectFundingCustom,
                        'cp_donor'                              =>  $projectCPDonor,
                        'imp_agencys'                           =>  $projectImpAge,
                        'cp_imp-partners'                       =>  $projectCPImpPart,
                        'duration_from'                         =>  $projectFrom,
                        'duration_to'                           =>  $projectTo,
                        'total_budget'                          =>  $projectBudget,
                        'type_of_support'                       =>  $projectSupType,
                        'support_modality'                      =>  $projectSupModal,
                        'support_cats_covered'                  =>  $projectSupCats,
                        'support_based_on'                      =>  $projectSupBased,
                        'project_connections'                   =>  $projectLinkedProj,
                        'other_info'                            =>  strip_tags($projectOtherInfo, $allowedTags),
                        'publish_status'                        =>  'publish',
                        'draft_creation'                        =>  $draftCreated,
                    ),
                );

                //echo 'functions script fiered';die();

                $update_project = wp_update_post($project);

                if(!is_wp_error($update_project)){ //PROJECT ADDED
                    $sendOnce = '1';
                    header("Location: /smtp_wp_mailer.php?revision_merged={$project_to_update}&send={$sendOnce}");
                    exit;
                }else{ //THERE WAS AN ERROR CREATING THE PROJECT
                    header("Location: /wp-admin/post.php?post={$revision}&action=edit&project_update_error");
                    exit;
                }
            }
        }
    }
}
add_action_once('publish_project_revisions', 'project_merge');

function revision_merge_success() {
    ?>
    <div class="notice notice-success is-dismissible">
        <p>Changes to the project has now been published. Currently watching the main Project.</p>
    </div>
    <?php
}
function revision_merge_error() {
    ?>
    <div class="notice notice-error is-dismissible">
        <p>Changes to the project could not be made. Please try again.</p>
    </div>
    <?php
}

if(isset($_GET['project_updated'])){ add_action('admin_notices', 'revision_merge_success' ); }           // Deactivatin success
if(isset($_GET['project_update_error'])){ add_action('admin_notices', 'revision_merge_error' ); }     // Deactivatin error

/*----------------------------------------------------*\
   PUBLISH PROJECT
\*----------------------------------------------------*/
function project_publish($post_id){
    if(!(wp_is_post_revision($post_id) || wp_is_post_autosave($post_id))) {

    	$post_type = get_post_type($post_id);

        if('project' != $post_type) : //Check if the posttype is Project. If not, do nothing.
            return;
        endif;

        $projectID = $post_id;
        $status = get_post_status($projectID);

        //If the post us updated to be published
        if($status = 'publish' && did_action('publish_project') === 1){
            header("Location: /smtp_wp_mailer.php?project_published={$projectID}");
            exit;
        }
    }
}
add_action('publish_project', 'project_publish');

function publish_project_success() {
    ?>
    <div class="notice notice-success is-dismissible">
        <p>The project was published and the Author has been notified.</p>
    </div>
    <?php
}

if(isset($_GET['project_published'])){ add_action('admin_notices', 'publish_project_success' ); }

/*------------------------------------*\
   BRÖDSMULOR
\*------------------------------------*/
function nobox_custom_breadcrumbs() {
    $avdelare   =   '<span class="delimiter">&raquo;</span> ';       /*-- Avdelare mellan brödsmuleobjekt --*/
    $hem        =   'Home';                                        /*-- Hem-text --*/
    $before     =   '<span>';                                       /*-- Kod före brödsmula --*/
    $after      =   '</span>';                                      /*-- Kod efter brödsmula --*/

    if(is_search()){
        $isSearch = 'isSearch';
    }else{
        $isSearch = '';
    }

    echo "<div id='breadcrumbs' class='{$isSearch}'>";

        global $post;
        $hemLank = get_bloginfo('url');

        echo '<a href="'. $hemLank .'">'. $hem .'</a> '. $avdelare .'';

        if (is_category()){ /*-- Skriv ut följande om det är en kategorisida --*/

            global $wp_query;
            $cat_obj = $wp_query->get_queried_object();
            $thisCat = $cat_obj->term_id;
            $thisCat = get_category($thisCat);
            $parentCat = get_category($thisCat->parent);

            if($thisCat->parent != 0) echo(get_category_parents($parentCat, TRUE, ' ' . $avdelare . ' '));
            echo '<a href="/news">News</a> '. $avdelare .'';
            echo $before . 'News category: ' . single_cat_title('', false) . '' . $after;

        }elseif(is_tax('story-categories')){ /*-- Skriv ut följande om det är arkivsida för en taxonomi --*/

            $current_term = single_term_title('', false);

            echo '<a href="/storys">Success Stories</a> '. $avdelare .'';
            echo $before . '' . $current_term . '' . $after;

        }elseif(is_day()){ /*-- Skriv ut följande om det är arkivsida för en dag --*/

            echo '<a href="' . get_year_link(get_the_time('Y')) . '">' . get_the_time('Y') . '</a> ' . $avdelare . ' ';
            echo '<a href="' . get_month_link(get_the_time('Y'),get_the_time('m')) . '">' . get_the_time('F') . '</a> ' . $avdelare . ' ';
            echo $before . 'Arkiv för datum: ' . get_the_time('d') . '' . $after;

        }elseif(is_month()){ /*-- Skriv ut följande om det är arkivsida för en månad --*/

            echo '<a href="' . get_year_link(get_the_time('Y')) . '">' . get_the_time('Y') . '</a> ' . $avdelare . ' ';
            echo $before . 'Arkiv för månad: ' . get_the_time('F') . '' . $after;

        }elseif(is_year()){ /*-- Skriv ut följande om det är arkivsida för ett år --*/

            echo $before . 'Arkiv för år: ' . get_the_time('Y') . '' . $after;

        }elseif(is_home()){ /*-- Skriv ut följande om det är arkivsida för ett år --*/

            echo $before . 'News' . $after;

        }elseif(is_single() && !is_attachment()){ /*-- Skriv ut följande om det är en singelsida men INTE en singelsida för en bilaga --*/
            if (get_post_type() != 'post' && get_post_type() != 'project'){

                $post_type = get_post_type_object(get_post_type());
                $slug = $post_type->rewrite;
                echo '<a href="' . $hemLank . '/' . $slug['slug'] . '/">' . $post_type->labels->singular_name . '</a>' . $avdelare . ' ';
                echo $before . get_the_title() . $after;

            }elseif(get_post_type() == 'project'){

                $post_type = get_post_type_object(get_post_type());
                $slug = $post_type->rewrite;
                echo '<a href="' . $hemLank . '/project-database/">Project database</a>' . $avdelare . ' ';
                echo $before . get_the_title() . $after;

            }else{

                $cat = get_the_category(); $cat = $cat[0];
                //echo ' ' . get_category_parents($cat, TRUE, ' ' . $avdelare . ' ') . ' ';
                //echo $before . 'Du läser: "' . get_the_title() . '"' . $after;
                echo '<a href="/news">News</a> '. $avdelare .'';
                echo $before . '' . get_the_title() . '' . $after;

            }
        }elseif(!is_single() && !is_page() && get_post_type() != 'post' && !is_404()){ /*-- Skriv ut följande om det är en CPT men INTE singel --*/

            $post_type = get_post_type_object(get_post_type());
            echo $before . $post_type->labels->singular_name . $after;

        }elseif(is_attachment()){ /*-- Skriv ut följande om det är en bilaga --*/

            $parent_id  = $post->post_parent;
            $breadcrumbs = array();
            while ($parent_id) {
                $page = get_page($parent_id);
                $breadcrumbs[] = '<a href="' . get_permalink($page->ID) . '">' . get_the_title($page->ID) . '</a>';
                $parent_id    = $page->post_parent;
            }
            $breadcrumbs = array_reverse($breadcrumbs);
            foreach($breadcrumbs as $crumb) echo ' ' . $crumb . ' ' . $avdelare . ' ';
            //echo $before . 'Du läser: "' . get_the_title() . '"' . $after;
            echo $before . ' ' . get_the_title() . '' . $after;

        }elseif(is_page() && !$post->post_parent){ /*-- Skriv ut följande om det är en sida utan en förälder --*/

            //echo $before . 'Du läser: "' . get_the_title() . '"' . $after;
            echo $before . '' . get_the_title() . '' . $after;

        }elseif(is_page() && $post->post_parent){ /*-- Skriv ut följande om det är en sida med en/flera föräldrar --*/

            $parent_id  = $post->post_parent;
            $breadcrumbs = array();
            while ($parent_id) {
                $page = get_page($parent_id);
                if($page->ID != '6'){
                $breadcrumbs[] = '<a href="' . get_permalink($page->ID) . '">' . get_the_title($page->ID) . '</a>';
                }
                $parent_id    = $page->post_parent;

            }
            $breadcrumbs = array_reverse($breadcrumbs);
            foreach ($breadcrumbs as $crumb) echo ' ' . $crumb . ' ' . $avdelare . ' ';
            //echo $before . 'Du läser: "' . get_the_title() . '"' . $after;
            echo $before . '' . get_the_title() . '' . $after;

        // }elseif(is_search()){ /*-- Skriv ut följande om det är sida för Sökresultat --*/
        //     echo $before . 'Search: ' . get_search_query() . '' . $after;

        }elseif(is_tag()){ /*-- Skriv ut följande om det är arkivsida för en Tagg --*/

            echo $before . 'Tagg: ' . single_tag_title('', false) . '' . $after;

        }elseif (is_author()){ /*-- Skriv ut följande om det är en profilsida --*/

            global $author;
            $userdata = get_userdata($author);
            echo $before . 'Artiklar av: ' . $userdata->display_name . '' . $after;

        }elseif(is_404()){ /*-- Skriv ut följande om det är 404 --*/

            //echo $before . 'Sidan kan inte hittas: "' . '404' . '"&nbsp;' . $after;
            echo $before . '' . '404' . '' . $after;
        }

        if(is_search()){
            echo '<span class="search_crumbs">' . $before . 'Search result: ' . get_search_query() . '' . $after. '</span>';
        }

        if (get_query_var('paged')) { /*-- Skriv ut följande om det är ett paginerat flöde --*/
            if ( is_category() || is_day() || is_month() || is_year() || is_search() || is_tag() || is_author() ) echo ' (';
            echo ('Page') . ' ' . get_query_var('paged');
            if ( is_category() || is_day() || is_month() || is_year() || is_search() || is_tag() || is_author() ) echo ')';
        }

    echo '</div>';
}

Zerion Mini Shell 1.0