diff --git a/wp-content/themes/aktiv2014/functions.php b/wp-content/themes/aktiv2014/functions.php index 21170cd..980ded3 100644 --- a/wp-content/themes/aktiv2014/functions.php +++ b/wp-content/themes/aktiv2014/functions.php @@ -11,9 +11,9 @@ add_image_size( 'feed' , 770, 433, true, 'center', 'top' ); * Register navigation menus. */ function neuf_register_nav_menus() { - register_nav_menus( - array( 'main-menu' => __( 'Hovedmeny' ) ) - ); + register_nav_menus( + array( 'main-menu' => __( 'Hovedmeny' ) ) + ); } add_action( 'init' , 'neuf_register_nav_menus' ); @@ -21,9 +21,9 @@ add_action( 'init' , 'neuf_register_nav_menus' ); * Enqueue various scripts we use. */ function neuf_enqueue_scripts() { - // enqueue the scripts - wp_enqueue_script( 'jquery' ); - wp_enqueue_script( 'underscore' ); + // enqueue the scripts + wp_enqueue_script( 'jquery' ); + wp_enqueue_script( 'underscore' ); } add_action( 'wp_enqueue_scripts' , 'neuf_enqueue_scripts' ); @@ -63,17 +63,17 @@ add_filter( 'wp_handle_upload_prefilter' , 'neuf_handle_upload_prefilter' ); /* Gets nicely the regular and member price nicely formated */ function neuf_get_price( $neuf_event ) { - $price_regular = get_post_meta( $neuf_event->ID , '_neuf_events_price_regular' , true ); - $price_member = get_post_meta( $neuf_event->ID , '_neuf_events_price_member' , true ); - if ( $price_regular ) { - if ( $price_member ) - $cc = "$price_regular/$price_member"; - else - $cc = $price_regular; - } else - $cc = ''; + $price_regular = get_post_meta( $neuf_event->ID , '_neuf_events_price_regular' , true ); + $price_member = get_post_meta( $neuf_event->ID , '_neuf_events_price_member' , true ); + if ( $price_regular ) { + if ( $price_member ) + $cc = "$price_regular/$price_member"; + else + $cc = $price_regular; + } else + $cc = ''; - return $cc; + return $cc; } /** @@ -83,15 +83,15 @@ function neuf_get_price( $neuf_event ) { * i) For pages, adds 'page-slug' */ function neuf_body_class( $classes = '' ) { - global $post; + global $post; - if ( $classes ) - $classes .= ' '; + if ( $classes ) + $classes .= ' '; - if ( is_page() ) - $classes .= 'page-' . $post->post_name ; + if ( is_page() ) + $classes .= 'page-' . $post->post_name ; - body_class( $classes ); + body_class( $classes ); } @@ -101,69 +101,69 @@ function neuf_body_class( $classes = '' ) { * Most of this borrowed from the Thematic theme framework. */ function neuf_doctitle() { - $site_name = get_bloginfo( 'name' ); - $separator = '|'; + $site_name = get_bloginfo( 'name' ); + $separator = '|'; - if ( is_single() ) { - $content = single_post_title( '' , false ); + if ( is_single() ) { + $content = single_post_title( '' , false ); - } elseif ( is_home() || is_front_page() ) { - $content = get_bloginfo( 'description' ); + } elseif ( is_home() || is_front_page() ) { + $content = get_bloginfo( 'description' ); - } elseif ( is_page() ) { - $content = single_post_title( '' , false ); + } elseif ( is_page() ) { + $content = single_post_title( '' , false ); - } elseif ( is_search() ) { - $content = __( 'Søkeresultater for', 'neuf-web' ); - $content .= ' ' . esc_html(stripslashes(get_search_query())); + } elseif ( is_search() ) { + $content = __( 'Søkeresultater for', 'neuf-web' ); + $content .= ' ' . esc_html(stripslashes(get_search_query())); - } elseif ( is_category() ) { - $content = __( 'Arkiv for kategorien' , 'neuf-web' ); - $content .= ' ' . single_cat_title( "" , false );; + } elseif ( is_category() ) { + $content = __( 'Arkiv for kategorien' , 'neuf-web' ); + $content .= ' ' . single_cat_title( "" , false );; - } elseif ( is_tag() ) { - $content = __( 'Arkiv for stikkordet' , 'neuf-web' ); - $content .= ' ' . neuf-web_tag_query(); + } elseif ( is_tag() ) { + $content = __( 'Arkiv for stikkordet' , 'neuf-web' ); + $content .= ' ' . neuf-web_tag_query(); - } elseif ( is_404() ) { - $content = __( 'Ikke funnet', 'neuf-web' ); + } elseif ( is_404() ) { + $content = __( 'Ikke funnet', 'neuf-web' ); - } else { - $content = get_bloginfo( 'description' ); - } + } else { + $content = get_bloginfo( 'description' ); + } - if ( get_query_var( 'paged' ) ) { - $content .= ' ' .$separator. ' '; - $content .= 'side'; - $content .= ' '; - $content .= get_query_var('paged'); - } + if ( get_query_var( 'paged' ) ) { + $content .= ' ' .$separator. ' '; + $content .= 'side'; + $content .= ' '; + $content .= get_query_var('paged'); + } - if($content) { - if ( is_home() || is_front_page() ) { - $elements = array( - 'site_name' => $site_name, - 'separator' => $separator, - 'content' => $content - ); - } else { - $elements = array( - 'content' => $content, - 'separator' => $separator, - 'site_name' => $site_name - ); - } - } else { - $elements = array( - 'site_name' => $site_name - ); - } + if($content) { + if ( is_home() || is_front_page() ) { + $elements = array( + 'site_name' => $site_name, + 'separator' => $separator, + 'content' => $content + ); + } else { + $elements = array( + 'content' => $content, + 'separator' => $separator, + 'site_name' => $site_name + ); + } + } else { + $elements = array( + 'site_name' => $site_name + ); + } - $doctitle = implode(' ', $elements); + $doctitle = implode(' ', $elements); - $doctitle = "\t" . "" . $doctitle . "" . "\n\n"; + $doctitle = "\t" . "" . $doctitle . "" . "\n\n"; - echo $doctitle; + echo $doctitle; } // end neuf_doctitle @@ -172,15 +172,15 @@ function neuf_doctitle() { * Display social sharing buttons */ function display_social_sharing_buttons() { ?> -
-
- - -
-
-
-
-
+
+
+ + +
+
+
+
+
* @author misund */ function neuf_get_attachment_count() { - global $post; + global $post; - $attachments = get_children( array( - 'post_parent' => $post->ID, - 'post_type' => 'any', - 'numberposts' => -1, - 'post_status' => 'any' - ) ); + $attachments = get_children( array( + 'post_parent' => $post->ID, + 'post_type' => 'any', + 'numberposts' => -1, + 'post_status' => 'any' + ) ); - return count( $attachments ); + return count( $attachments ); } /** @@ -213,8 +213,8 @@ function neuf_get_attachment_count() { * @author misund */ function neuf_maybe_display_gallery() { - if ( 2 < neuf_get_attachment_count() ) - echo do_shortcode( '[gallery]' ); + if ( 2 < neuf_get_attachment_count() ) + echo do_shortcode( '[gallery]' ); } /** @@ -222,21 +222,21 @@ function neuf_maybe_display_gallery() { * If $text is truncated, then "[..]" is appended. */ function trim_excerpt($text, $length) { - $org_length = strlen($text); - $text = explode(" ", $text); // word boundary - $text = array_slice($text, 0, $length); - $text = implode(" ", $text); - $shorter = $org_length != strlen($text) ? " [...]" : ""; - return $text . $shorter; + $org_length = strlen($text); + $text = explode(" ", $text); // word boundary + $text = array_slice($text, 0, $length); + $text = implode(" ", $text); + $shorter = $org_length != strlen($text) ? " [...]" : ""; + return $text . $shorter; } /** * Replaces the matching $pattern with $replacement in the string $subject. */ function linkify($subject, $pattern, $link) { - $replacement = '[...]'; - $output = preg_replace($pattern, $replacement, $subject); - return $output; + $replacement = '[...]'; + $output = preg_replace($pattern, $replacement, $subject); + return $output; } /** @@ -245,72 +245,72 @@ function linkify($subject, $pattern, $link) { * Original author: Ian Stewart (theme Thematic). */ function neuf_page_title() { - - global $post; - - $content = ''; - if (is_attachment()) { - $content .= '

Tilbake til '; - $content .= get_the_title($post->post_parent); - $content .= '

'; - } elseif (is_author()) { - $content .= '

'; - $author = get_the_author_meta( 'display_name' ); - $content .= __('Innhold skrevet av', 'neuf'); - $content .= ' '; - $content .= $author; - $content .= '

'; - } elseif (is_category()) { - $content .= '

'; - $content .= __('Innhold i kategorien', 'neuf'); - $content .= ' '; - $content .= single_cat_title('', FALSE); - $content .= '

' . "\n"; - $content .= '
'; - if ( !(''== category_description()) ) : $content .= apply_filters('archive_meta', category_description()); endif; - $content .= '
'; - } elseif (is_search()) { - $content .= '

'; - $content .= __('Søkeresultater for:', 'neuf'); - $content .= ' '; - $content .= esc_html(stripslashes($_GET['s'])); - $content .= '

'; - } elseif (is_tag()) { - $content .= '

'; - $content .= __('Innhold merket med', 'neuf'); - $content .= ' '; - $content .= __(neuf_tag_query()); - $content .= '

'; - } elseif (is_tax()) { - global $taxonomy; - $content .= '

'; - $tax = get_taxonomy($taxonomy); - $content .= $tax->labels->name . ' '; - $content .= __('Arkiv:', 'neuf'); - $content .= ' '; - $content .= neuf_get_term_name(); - $content .= '

'; - } elseif (is_day()) { - $content .= '

'; - $content .= sprintf(__('Innhold fra dagen %s', 'neuf'), get_the_time(get_option('date_format'))); - $content .= '

'; - } elseif (is_month()) { - $content .= '

'; - $content .= sprintf(__('Innhold fra måneden %s', 'neuf'), get_the_time('F Y')); - $content .= '

'; - } elseif (is_year()) { - $content .= '

'; - $content .= sprintf(__('Innhold fra året %s', 'neuf'), get_the_time('Y')); - $content .= '

'; - } elseif (isset($_GET['paged']) && !empty($_GET['paged'])) { - $content .= '

'; - $content .= __('Arkiv', 'neuf'); - $content .= '

'; - } - $content .= "\n"; - echo( $content ); + + global $post; + + $content = ''; + if (is_attachment()) { + $content .= '

Tilbake til '; + $content .= get_the_title($post->post_parent); + $content .= '

'; + } elseif (is_author()) { + $content .= '

'; + $author = get_the_author_meta( 'display_name' ); + $content .= __('Innhold skrevet av', 'neuf'); + $content .= ' '; + $content .= $author; + $content .= '

'; + } elseif (is_category()) { + $content .= '

'; + $content .= __('Innhold i kategorien', 'neuf'); + $content .= ' '; + $content .= single_cat_title('', FALSE); + $content .= '

' . "\n"; + $content .= '
'; + if ( !(''== category_description()) ) : $content .= apply_filters('archive_meta', category_description()); endif; + $content .= '
'; + } elseif (is_search()) { + $content .= '

'; + $content .= __('Søkeresultater for:', 'neuf'); + $content .= ' '; + $content .= esc_html(stripslashes($_GET['s'])); + $content .= '

'; + } elseif (is_tag()) { + $content .= '

'; + $content .= __('Innhold merket med', 'neuf'); + $content .= ' '; + $content .= __(neuf_tag_query()); + $content .= '

'; + } elseif (is_tax()) { + global $taxonomy; + $content .= '

'; + $tax = get_taxonomy($taxonomy); + $content .= $tax->labels->name . ' '; + $content .= __('Arkiv:', 'neuf'); + $content .= ' '; + $content .= neuf_get_term_name(); + $content .= '

'; + } elseif (is_day()) { + $content .= '

'; + $content .= sprintf(__('Innhold fra dagen %s', 'neuf'), get_the_time(get_option('date_format'))); + $content .= '

'; + } elseif (is_month()) { + $content .= '

'; + $content .= sprintf(__('Innhold fra måneden %s', 'neuf'), get_the_time('F Y')); + $content .= '

'; + } elseif (is_year()) { + $content .= '

'; + $content .= sprintf(__('Innhold fra året %s', 'neuf'), get_the_time('Y')); + $content .= '

'; + } elseif (isset($_GET['paged']) && !empty($_GET['paged'])) { + $content .= '

'; + $content .= __('Arkiv', 'neuf'); + $content .= '

'; + } + $content .= "\n"; + echo( $content ); } /** @@ -320,27 +320,27 @@ function neuf_page_title() { */ function neuf_tag_query() { - $nice_tag_query = get_query_var('tag'); // tags in current query - $nice_tag_query = str_replace(' ', '+', $nice_tag_query); // get_query_var returns ' ' for AND, replace by + - $tag_slugs = preg_split('%[,+]%', $nice_tag_query, -1, PREG_SPLIT_NO_EMPTY); // create array of tag slugs - $tag_ops = preg_split('%[^,+]*%', $nice_tag_query, -1, PREG_SPLIT_NO_EMPTY); // create array of operators + $nice_tag_query = get_query_var('tag'); // tags in current query + $nice_tag_query = str_replace(' ', '+', $nice_tag_query); // get_query_var returns ' ' for AND, replace by + + $tag_slugs = preg_split('%[,+]%', $nice_tag_query, -1, PREG_SPLIT_NO_EMPTY); // create array of tag slugs + $tag_ops = preg_split('%[^,+]*%', $nice_tag_query, -1, PREG_SPLIT_NO_EMPTY); // create array of operators - $tag_ops_counter = 0; - $nice_tag_query = ''; + $tag_ops_counter = 0; + $nice_tag_query = ''; - foreach ($tag_slugs as $tag_slug) { - $tag = get_term_by('slug', $tag_slug ,'post_tag'); - // prettify tag operator, if any - if ($tag_ops[$tag_ops_counter] == ',') { - $tag_ops[$tag_ops_counter] = ', '; - } elseif ($tag_ops[$tag_ops_counter] == '+') { - $tag_ops[$tag_ops_counter] = ' + '; - } - // concatenate display name and prettified operators - $nice_tag_query = $nice_tag_query.$tag->name.$tag_ops[$tag_ops_counter]; - $tag_ops_counter += 1; - } - return $nice_tag_query; + foreach ($tag_slugs as $tag_slug) { + $tag = get_term_by('slug', $tag_slug ,'post_tag'); + // prettify tag operator, if any + if ($tag_ops[$tag_ops_counter] == ',') { + $tag_ops[$tag_ops_counter] = ', '; + } elseif ($tag_ops[$tag_ops_counter] == '+') { + $tag_ops[$tag_ops_counter] = ' + '; + } + // concatenate display name and prettified operators + $nice_tag_query = $nice_tag_query.$tag->name.$tag_ops[$tag_ops_counter]; + $tag_ops_counter += 1; + } + return $nice_tag_query; } /** @@ -349,19 +349,19 @@ function neuf_tag_query() { * Original author: Justin Tadlock (theme Hybrid). */ function neuf_get_term_name() { - $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) ); - return $term->name; + $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) ); + return $term->name; } /* Widgets */ function neuf_widgets_init() { - register_sidebar( array( - 'name' => 'Home right sidebar', - 'id' => 'main_sidebar', - 'before_widget' => '
', - 'after_widget' => '
', - ) ); + register_sidebar( array( + 'name' => 'Home right sidebar', + 'id' => 'main_sidebar', + 'before_widget' => '
', + 'after_widget' => '
', + ) ); } add_action( 'widgets_init', 'neuf_widgets_init' ); @@ -374,20 +374,20 @@ add_action( 'widgets_init', 'neuf_widgets_init' ); * @return string */ function neuf_login_redirect( $redirect_to, $request, $user ) { - //is there a user to check? - global $user; - if ( isset($user) ) { + //is there a user to check? + global $user; + if ( isset($user) ) { // Redirect to homepage return home_url()."?yourin"; - } else { - return $redirect_to; - } + } else { + return $redirect_to; + } } add_filter( 'login_redirect', 'neuf_login_redirect', 10, 3 ); /* No admin bar for mortals */ function neuf_show_admin_bar($content) { - return ( current_user_can( 'administrator' ) ) ? $content : false; + return ( current_user_can( 'administrator' ) ) ? $content : false; } add_filter( 'show_admin_bar' , 'neuf_show_admin_bar'); @@ -406,62 +406,62 @@ function neuf_load_dashicons() { /* Read more link */ function neuf_excerpt_more( $more ) { - return '...'; + return '...'; } add_filter( 'excerpt_more', 'neuf_excerpt_more' ); /* Save user meta options */ function neuf_save_user_meta() { - global $wpdb; + global $wpdb; - $user_id = (int) $_POST['user_id']; - $meta_key = $_POST['meta_key']; // TODO: sanitize - $meta_value = $_POST['meta_value']; // TODO: sanitize - $unique = (bool) $_POST['unique']; + $user_id = (int) $_POST['user_id']; + $meta_key = $_POST['meta_key']; // TODO: sanitize + $meta_value = $_POST['meta_value']; // TODO: sanitize + $unique = (bool) $_POST['unique']; - if( !get_userdata($user_id) ) { - die(json_encode(array('error' => 'Invalid user_id: \''. $_POST['user_id'] .'\''))); - } - if( !is_user_logged_in() ) { - die(json_encode(array('error' => 'Log in first'))); - } + if( !get_userdata($user_id) ) { + die(json_encode(array('error' => 'Invalid user_id: \''. $_POST['user_id'] .'\''))); + } + if( !is_user_logged_in() ) { + die(json_encode(array('error' => 'Log in first'))); + } - if( !wp_verify_nonce( $_POST['_wpnonce'], 'user-meta' ) ) { - die(json_encode(array('error' => 'Invalid nonce'))); - } + if( !wp_verify_nonce( $_POST['_wpnonce'], 'user-meta' ) ) { + die(json_encode(array('error' => 'Invalid nonce'))); + } - $meta_id = add_user_meta($user_id, $meta_key, $meta_value, $unique); + $meta_id = add_user_meta($user_id, $meta_key, $meta_value, $unique); - if( !$meta_id ) { - die(json_encode(array('result' => 'User meta NOT updated!'))); - } - else{ - die(json_encode(array('result' => 'User meta updated.'))); - } + if( !$meta_id ) { + die(json_encode(array('result' => 'User meta NOT updated!'))); + } + else{ + die(json_encode(array('result' => 'User meta updated.'))); + } } add_action( 'wp_ajax_neuf_save_user_meta', 'neuf_save_user_meta' ); /* Save user meta options */ function neuf_get_user_meta() { - global $wpdb; + global $wpdb; - $user_id = (int) $_GET['user_id']; - $meta_key = $_GET['meta_key']; // TODO: sanitize - $single = (bool) $_GET['single']; + $user_id = (int) $_GET['user_id']; + $meta_key = $_GET['meta_key']; // TODO: sanitize + $single = (bool) $_GET['single']; - if( !get_userdata($user_id) ) { - die(json_encode(array('error' => 'Invalid user_id: \''. $_GET['user_id'] .'\''))); - } - if( !is_user_logged_in() ) { - die(json_encode(array('error' => 'Log in first'))); - } + if( !get_userdata($user_id) ) { + die(json_encode(array('error' => 'Invalid user_id: \''. $_GET['user_id'] .'\''))); + } + if( !is_user_logged_in() ) { + die(json_encode(array('error' => 'Log in first'))); + } - if( !wp_verify_nonce( $_GET['_wpnonce'], 'user-meta' ) ) { - die(json_encode(array('error' => 'Invalid nonce'))); - } + if( !wp_verify_nonce( $_GET['_wpnonce'], 'user-meta' ) ) { + die(json_encode(array('error' => 'Invalid nonce'))); + } - $meta_value = get_user_meta($user_id, $meta_key, $single); - die(json_encode(array('result' => $meta_value))); + $meta_value = get_user_meta($user_id, $meta_key, $single); + die(json_encode(array('result' => $meta_value))); } add_action( 'wp_ajax_neuf_get_user_meta', 'neuf_get_user_meta' ); @@ -475,4 +475,19 @@ function neuf_rsa_feed_override( $is_restricted ) { return $is_restricted; } add_filter( 'restricted_site_access_is_restricted', 'neuf_rsa_feed_override' ); -?> + +function get_feed_url() { + $url = get_bloginfo('url'); + $feedurl = "$url/feed/"; + + if(is_user_logged_in()) { + $user = wp_get_current_user(); + $feedkey = get_usermeta($user->ID, 'feed_key'); + $feedurl .= "?feedkey=$feedkey"; + } + return $feedurl; +} + +remove_action( 'wp_head', 'feed_links_extra', 3 ); // Display the links to the extra feeds such as category feeds +remove_action( 'wp_head', 'feed_links', 2 ); // Display the links to the general feeds: Post and Comment Feed +?> \ No newline at end of file diff --git a/wp-content/themes/aktiv2014/header.php b/wp-content/themes/aktiv2014/header.php index 8b6a87b..9618dbe 100644 --- a/wp-content/themes/aktiv2014/header.php +++ b/wp-content/themes/aktiv2014/header.php @@ -13,7 +13,7 @@ - + diff --git a/wp-content/themes/aktiv2014/page-profile.php b/wp-content/themes/aktiv2014/page-profile.php index d548988..715b713 100644 --- a/wp-content/themes/aktiv2014/page-profile.php +++ b/wp-content/themes/aktiv2014/page-profile.php @@ -42,11 +42,7 @@ get_header();

Endre passordet ditt via Brukerinfo.

Annet
- ID, 'feed_key'); - $feedurl = get_bloginfo('url').'/feed/?feedkey='.$feedkey; - ?> - Privat RSS-feed + RSS-strøm - Nyheter Vis i Inside