Points RSS-feed link tag to private feed
This commit is contained in:
1 parent
0ff15902a6
commit
b6892136f3
3 files changed
+255
-244
No files matched your search
@@ -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" . "<title>" . $doctitle . "</title>" . "\n\n";
|
||||
$doctitle = "\t" . "<title>" . $doctitle . "</title>" . "\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() { ?>
|
||||
<div id="social-sharing">
|
||||
<div class="share-twitter">
|
||||
<a href="https://twitter.com/share" class="twitter-share-button" data-lang="no">Tweet</a>
|
||||
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
|
||||
</div> <!-- .share-twitter -->
|
||||
<div class="share-facebook">
|
||||
<div class="fb-like" data-send="true" data-layout="button_count" data-width="450" data-show-faces="true" data-action="recommend"></div>
|
||||
</div> <!-- .share-facebook -->
|
||||
</div> <!-- #social-sharing -->
|
||||
<div id="social-sharing">
|
||||
<div class="share-twitter">
|
||||
<a href="https://twitter.com/share" class="twitter-share-button" data-lang="no">Tweet</a>
|
||||
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
|
||||
</div> <!-- .share-twitter -->
|
||||
<div class="share-facebook">
|
||||
<div class="fb-like" data-send="true" data-layout="button_count" data-width="450" data-show-faces="true" data-action="recommend"></div>
|
||||
</div> <!-- .share-facebook -->
|
||||
</div> <!-- #social-sharing -->
|
||||
<?php }
|
||||
|
||||
/**
|
||||
@@ -191,16 +191,16 @@ 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 = '<a href="'.$link.'">[...]</a>';
|
||||
$output = preg_replace($pattern, $replacement, $subject);
|
||||
return $output;
|
||||
$replacement = '<a href="'.$link.'">[...]</a>';
|
||||
$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 .= '<h1 class="page-title"><a href="';
|
||||
$content .= apply_filters('the_permalink',get_permalink($post->post_parent));
|
||||
$content .= '" rev="attachment"><span class="meta-nav">Tilbake til </span>';
|
||||
$content .= get_the_title($post->post_parent);
|
||||
$content .= '</a></h1>';
|
||||
} elseif (is_author()) {
|
||||
$content .= '<h1 class="page-title author">';
|
||||
$author = get_the_author_meta( 'display_name' );
|
||||
$content .= __('Innhold skrevet av', 'neuf');
|
||||
$content .= ' <span>';
|
||||
$content .= $author;
|
||||
$content .= '</span></h1>';
|
||||
} elseif (is_category()) {
|
||||
$content .= '<h1 class="page-title">';
|
||||
$content .= __('Innhold i kategorien', 'neuf');
|
||||
$content .= ' <span>';
|
||||
$content .= single_cat_title('', FALSE);
|
||||
$content .= '</span></h1>' . "\n";
|
||||
$content .= '<div class="archive-meta">';
|
||||
if ( !(''== category_description()) ) : $content .= apply_filters('archive_meta', category_description()); endif;
|
||||
$content .= '</div>';
|
||||
} elseif (is_search()) {
|
||||
$content .= '<h1 class="page-title">';
|
||||
$content .= __('Søkeresultater for:', 'neuf');
|
||||
$content .= ' <span id="search-terms">';
|
||||
$content .= esc_html(stripslashes($_GET['s']));
|
||||
$content .= '</span></h1>';
|
||||
} elseif (is_tag()) {
|
||||
$content .= '<h1 class="page-title">';
|
||||
$content .= __('Innhold merket med', 'neuf');
|
||||
$content .= ' <span>';
|
||||
$content .= __(neuf_tag_query());
|
||||
$content .= '</span></h1>';
|
||||
} elseif (is_tax()) {
|
||||
global $taxonomy;
|
||||
$content .= '<h1 class="page-title">';
|
||||
$tax = get_taxonomy($taxonomy);
|
||||
$content .= $tax->labels->name . ' ';
|
||||
$content .= __('Arkiv:', 'neuf');
|
||||
$content .= ' <span>';
|
||||
$content .= neuf_get_term_name();
|
||||
$content .= '</span></h1>';
|
||||
} elseif (is_day()) {
|
||||
$content .= '<h1 class="page-title">';
|
||||
$content .= sprintf(__('Innhold fra dagen <span>%s</span>', 'neuf'), get_the_time(get_option('date_format')));
|
||||
$content .= '</h1>';
|
||||
} elseif (is_month()) {
|
||||
$content .= '<h1 class="page-title">';
|
||||
$content .= sprintf(__('Innhold fra måneden <span>%s</span>', 'neuf'), get_the_time('F Y'));
|
||||
$content .= '</h1>';
|
||||
} elseif (is_year()) {
|
||||
$content .= '<h1 class="page-title">';
|
||||
$content .= sprintf(__('Innhold fra året <span>%s</span>', 'neuf'), get_the_time('Y'));
|
||||
$content .= '</h1>';
|
||||
} elseif (isset($_GET['paged']) && !empty($_GET['paged'])) {
|
||||
$content .= '<h1 class="page-title">';
|
||||
$content .= __('Arkiv', 'neuf');
|
||||
$content .= '</h1>';
|
||||
}
|
||||
$content .= "\n";
|
||||
echo( $content );
|
||||
|
||||
global $post;
|
||||
|
||||
$content = '';
|
||||
if (is_attachment()) {
|
||||
$content .= '<h1 class="page-title"><a href="';
|
||||
$content .= apply_filters('the_permalink',get_permalink($post->post_parent));
|
||||
$content .= '" rev="attachment"><span class="meta-nav">Tilbake til </span>';
|
||||
$content .= get_the_title($post->post_parent);
|
||||
$content .= '</a></h1>';
|
||||
} elseif (is_author()) {
|
||||
$content .= '<h1 class="page-title author">';
|
||||
$author = get_the_author_meta( 'display_name' );
|
||||
$content .= __('Innhold skrevet av', 'neuf');
|
||||
$content .= ' <span>';
|
||||
$content .= $author;
|
||||
$content .= '</span></h1>';
|
||||
} elseif (is_category()) {
|
||||
$content .= '<h1 class="page-title">';
|
||||
$content .= __('Innhold i kategorien', 'neuf');
|
||||
$content .= ' <span>';
|
||||
$content .= single_cat_title('', FALSE);
|
||||
$content .= '</span></h1>' . "\n";
|
||||
$content .= '<div class="archive-meta">';
|
||||
if ( !(''== category_description()) ) : $content .= apply_filters('archive_meta', category_description()); endif;
|
||||
$content .= '</div>';
|
||||
} elseif (is_search()) {
|
||||
$content .= '<h1 class="page-title">';
|
||||
$content .= __('Søkeresultater for:', 'neuf');
|
||||
$content .= ' <span id="search-terms">';
|
||||
$content .= esc_html(stripslashes($_GET['s']));
|
||||
$content .= '</span></h1>';
|
||||
} elseif (is_tag()) {
|
||||
$content .= '<h1 class="page-title">';
|
||||
$content .= __('Innhold merket med', 'neuf');
|
||||
$content .= ' <span>';
|
||||
$content .= __(neuf_tag_query());
|
||||
$content .= '</span></h1>';
|
||||
} elseif (is_tax()) {
|
||||
global $taxonomy;
|
||||
$content .= '<h1 class="page-title">';
|
||||
$tax = get_taxonomy($taxonomy);
|
||||
$content .= $tax->labels->name . ' ';
|
||||
$content .= __('Arkiv:', 'neuf');
|
||||
$content .= ' <span>';
|
||||
$content .= neuf_get_term_name();
|
||||
$content .= '</span></h1>';
|
||||
} elseif (is_day()) {
|
||||
$content .= '<h1 class="page-title">';
|
||||
$content .= sprintf(__('Innhold fra dagen <span>%s</span>', 'neuf'), get_the_time(get_option('date_format')));
|
||||
$content .= '</h1>';
|
||||
} elseif (is_month()) {
|
||||
$content .= '<h1 class="page-title">';
|
||||
$content .= sprintf(__('Innhold fra måneden <span>%s</span>', 'neuf'), get_the_time('F Y'));
|
||||
$content .= '</h1>';
|
||||
} elseif (is_year()) {
|
||||
$content .= '<h1 class="page-title">';
|
||||
$content .= sprintf(__('Innhold fra året <span>%s</span>', 'neuf'), get_the_time('Y'));
|
||||
$content .= '</h1>';
|
||||
} elseif (isset($_GET['paged']) && !empty($_GET['paged'])) {
|
||||
$content .= '<h1 class="page-title">';
|
||||
$content .= __('Arkiv', 'neuf');
|
||||
$content .= '</h1>';
|
||||
}
|
||||
$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' => '<div class="widget">',
|
||||
'after_widget' => '</div>',
|
||||
) );
|
||||
register_sidebar( array(
|
||||
'name' => 'Home right sidebar',
|
||||
'id' => 'main_sidebar',
|
||||
'before_widget' => '<div class="widget">',
|
||||
'after_widget' => '</div>',
|
||||
) );
|
||||
}
|
||||
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
|
||||
?>
|
||||
@@ -13,7 +13,7 @@
|
||||
<meta name="x-siteurl" content="<?php echo get_option('siteurl'); ?>" />
|
||||
<?php neuf_doctitle(); ?>
|
||||
<link rel="icon" type="image/png" href="favicon.ico" />
|
||||
<link rel="alternate" type="application/rss+xml" href="<?php bloginfo('url'); ?>/feed/" title="Aktiv-nyheter" />
|
||||
<link rel="alternate" type="application/rss+xml" href="<?php echo get_feed_url(); ?>" title="aktiv.neuf.no - Nyheter" />
|
||||
|
||||
<link href="<?php bloginfo( 'stylesheet_directory' ); ?>/dist/styles/main.css" rel="stylesheet" type="text/css" />
|
||||
<link href='//fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,700,800,600' rel='stylesheet' type='text/css'>
|
||||
|
||||
@@ -42,11 +42,7 @@ get_header();
|
||||
<p>Endre passordet ditt via <a href="https://brukerinfo.neuf.no">Brukerinfo</a>.</p>
|
||||
<p></p>
|
||||
<h5>Annet</h5>
|
||||
<?php
|
||||
$feedkey = get_usermeta($user->ID, 'feed_key');
|
||||
$feedurl = get_bloginfo('url').'/feed/?feedkey='.$feedkey;
|
||||
?>
|
||||
<a href="<?php echo $feedurl; ?>">Privat RSS-feed</a>
|
||||
<a href="<?php echo get_feed_url(); ?>">RSS-strøm - Nyheter</a>
|
||||
<?php else: ?>
|
||||
<a href="#" class="button radius js-inside-link">Vis i Inside</a>
|
||||
<?php endif; ?>
|
||||
|
||||
Reference in new issue
Block a user