kvenugopal
Forum Replies Created
-
Forum: Plugins
In reply to: [Front End Users] Restrict Access to Special PostsHi Rustaurius,
Thanks. But for a small change, I can’t go look for a developer because he/she needs to understand the theme & plugin functionality etc. Since there are other plugin options like Restrict Content, Membership plugins etc available in the directory that could serve my purpose, I would rather NOT use Front-End Only Users plugin.
Anyway thanks for sparing time for me.
Regards-VenuForum: Plugins
In reply to: [Front End Users] Restrict Access to Special PostsHey Rustarius,
Thanks for the kind reply.
The coupons page is a menu link & the coupons are custom posts, as far as my limited knowledge goes. Probably in WP, it is called an Archive page?
Now, since I am not a programmer, I am not sure about editing the functions.php file.
I don’t see a way to attach a notepad file, hence I have copied the code of “functions.php” as below. Kindly take a look & see if you can make any sense of it.<?php
/**
* starter functions and definitions.
*
* @link https://developer.wordpress.org/themes/basics/theme-functions/
*
* @package starter
*/if ( ! function_exists( ‘starter_setup’ ) ) :
function starter_setup() {
load_theme_textdomain( ‘starter’, get_template_directory() . ‘/languages’ );
// Add default posts and comments RSS feed links to head.
add_theme_support( ‘automatic-feed-links’ );/*
* Let WordPress manage the document title.
* By adding theme support, we declare that this theme does not use a
* hard-coded <title> tag in the document head, and expect WordPress to
* provide it for us.
*/
add_theme_support( ‘title-tag’ );/*
* Enable support for Post Thumbnails on posts and pages.
*
* @link https://developer.wordpress.org/themes/functionality/featured-images-post-thumbnails/
*/
add_theme_support( ‘post-thumbnails’ );// This theme uses wp_nav_menu() in one location.
register_nav_menus( array(
‘primary’ => esc_html__( ‘Primary Menu’, ‘starter’ ),
‘footer’ => esc_html__( ‘Footer Menu’, ‘starter’ ),
) );/*
* Switch default core markup for search form, comment form, and comments
* to output valid HTML5.
*/
add_theme_support( ‘html5’, array(
‘search-form’,
‘comment-form’,
‘comment-list’,
‘gallery’,
‘caption’,
) );// Set up the WordPress core custom background feature.
add_theme_support( ‘custom-background’, apply_filters( ‘starter_custom_background_args’, array(
‘default-color’ => ‘ffffff’,
‘default-image’ => ”,
) ) );add_editor_style();
}
endif;
add_action( ‘after_setup_theme’, ‘starter_setup’ );/**
* Set the content width in pixels, based on the theme’s design and stylesheet.
*
* Priority 0 to make it available to lower priority callbacks.
*
* @global int $content_width
*/
function starter_content_width() {
$GLOBALS[‘content_width’] = apply_filters( ‘starter_content_width’, 760 );
}
add_action( ‘after_setup_theme’, ‘starter_content_width’, 0 );/**
* Register widget area.
*
* @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar
*/
function starter_sidebar_init() {register_sidebar( array(
‘name’ => esc_html__( ‘Sidebar’, ‘starter’ ),
‘id’ => ‘sidebar-1’,
‘description’ => esc_html__( ‘Add widgets here.’, ‘starter’ ),
‘before_widget’ => ‘<div id=”%1$s” class=”widget %2$s”>’,
‘after_widget’ => ‘</div>’,
‘before_title’ => ‘<h2 class=”widget-title”>’,
‘after_title’ => ‘</h2>’,
) );register_sidebar( array(
‘name’ => esc_html__( ‘Header Newsletter’, ‘starter’ ),
‘id’ => ‘header-newsletter’,
‘description’ => esc_html__( ‘Drag the “Newsletter” widget here.’, ‘starter’ ),
‘before_widget’ => ‘<div id=”%1$s” class=”header-promo %2$s”>’,
‘after_widget’ => ‘</div>’,
‘before_title’ => ‘<h3 class=”widget-title”>’,
‘after_title’ => ‘</h3>’,
) );register_sidebar( array(
‘name’ => esc_html__( ‘Footer Column 1’, ‘starter’ ),
‘id’ => ‘footer-1’,
‘description’ => esc_html__( ‘Add widgets here.’, ‘starter’ ),
‘before_widget’ => ‘<div id=”%1$s” class=”widget footer-widget %2$s”>’,
‘after_widget’ => ‘</div>’,
‘before_title’ => ‘<h3 class=”widget-title”>’,
‘after_title’ => ‘</h3>’,
) );
register_sidebar( array(
‘name’ => esc_html__( ‘Footer Column 2’, ‘starter’ ),
‘id’ => ‘footer-2’,
‘description’ => esc_html__( ‘Add widgets here.’, ‘starter’ ),
‘before_widget’ => ‘<div id=”%1$s” class=”widget footer-widget %2$s”>’,
‘after_widget’ => ‘</div>’,
‘before_title’ => ‘<h3 class=”widget-title”>’,
‘after_title’ => ‘</h3>’,
) );
register_sidebar( array(
‘name’ => esc_html__( ‘Footer Column 3’, ‘starter’ ),
‘id’ => ‘footer-3’,
‘description’ => esc_html__( ‘Add widgets here.’, ‘starter’ ),
‘before_widget’ => ‘<div id=”%1$s” class=”widget footer-widget %2$s”>’,
‘after_widget’ => ‘</div>’,
‘before_title’ => ‘<h3 class=”widget-title”>’,
‘after_title’ => ‘</h3>’,
) );
register_sidebar( array(
‘name’ => esc_html__( ‘Footer Column 4’, ‘starter’ ),
‘id’ => ‘footer-4’,
‘description’ => esc_html__( ‘Add widgets here.’, ‘starter’ ),
‘before_widget’ => ‘<div id=”%1$s” class=”widget footer-widget %2$s”>’,
‘after_widget’ => ‘</div>’,
‘before_title’ => ‘<h3 class=”widget-title”>’,
‘after_title’ => ‘</h3>’,
) );
}
add_action( ‘widgets_init’, ‘starter_sidebar_init’ );/**
* Implement the Custom Header feature.
*/
require get_template_directory() . ‘/inc/custom-header.php’;/**
* Custom template tags for this theme.
*/
require get_template_directory() . ‘/inc/template-tags.php’;/**
* Custom functions that act independently of the theme templates.
*/
require get_template_directory() . ‘/inc/extras.php’;/**
* Customizer additions.
*/require get_template_directory() . ‘/admin/customizer-library.php’;
require get_template_directory() . ‘/admin/customizer-options.php’;
require get_template_directory() . ‘/admin/styles.php’;
require get_template_directory() . ‘/admin/mods.php’;
require get_template_directory() . ‘/inc/customizer.php’;
/**
* Load Jetpack compatibility file.
*/
require get_template_directory() . ‘/inc/jetpack.php’;/**
* Load plugins.
*/
require get_template_directory() . ‘/inc/plugins.php’;/**
* Enqueues scripts and styles.
*/
function starter_scripts() {// load jquery if it isn’t
//wp_enqueue_script(‘jquery’);
wp_enqueue_script(‘jquery’, get_stylesheet_directory_uri() . ‘/assets/js/jquery.js’, array(), ”, true );// Enqueues Javascripts
wp_enqueue_script( ‘superfish’, get_stylesheet_directory_uri() . ‘/assets/js/superfish.js’, array(), ”, true );
wp_enqueue_script( ‘slicknav’, get_stylesheet_directory_uri() . ‘/assets/js/jquery.slicknav.min.js’, array(), ”, true );
wp_enqueue_script( ‘modernizr’, get_stylesheet_directory_uri() . ‘/assets/js/modernizr.min.js’,array(), ”, true );
wp_enqueue_script( ‘html5’, get_template_directory_uri() . ‘/assets/js/html5.js’, array(), ”, true );
wp_enqueue_script( ‘clipboard’, get_template_directory_uri() . ‘/assets/js/clipboard.min.js’, array(), ”, true );
wp_enqueue_script( ‘modal’, get_template_directory_uri() . ‘/assets/js/jquery.modal.min.js’, array(), ”, true );
wp_enqueue_script( ‘custom’, get_stylesheet_directory_uri() . ‘/assets/js/jquery.custom.js’, array(), ‘20170604’, true );// Enqueues CSS styles
wp_enqueue_style( ‘starter-style’, get_stylesheet_uri(), array(), ‘20161209’ );
wp_enqueue_style( ‘superfish-style’, get_template_directory_uri() . ‘/assets/css/superfish.css’ );
wp_enqueue_style( ‘genericons-style’, get_template_directory_uri() . ‘/genericons/genericons.css’ );
wp_enqueue_style( ‘modal-style’, get_template_directory_uri() . ‘/assets/css/jquery.modal.css’ );if ( get_theme_mod( ‘site-layout’, ‘choice-1’ ) == ‘choice-1’ ) {
wp_enqueue_style( ‘responsive-style’, get_template_directory_uri() . ‘/responsive.css’, array(), ‘20161209’ );
}if ( is_singular() && comments_open() && get_option( ‘thread_comments’ ) ) {
wp_enqueue_script( ‘comment-reply’ );
}
}
add_action( ‘wp_enqueue_scripts’, ‘starter_scripts’ );/**
* Post Thumbnails.
*/
if ( function_exists( ‘add_theme_support’ ) ) {
add_theme_support( ‘post-thumbnails’ );
set_post_thumbnail_size( 300, 300, true ); // default Post Thumbnail dimensions (cropped)
add_image_size( ‘single_thumb’, 600, 360, true );
}/**
* Registers custom widgets.
*/
function starter_widgets_init() {require trailingslashit( get_template_directory() ) . ‘inc/widgets/widget-popular.php’;
register_widget( ‘starter_Popular_Widget’ );require trailingslashit( get_template_directory() ) . ‘inc/widgets/widget-recent.php’;
register_widget( ‘starter_Recent_Widget’ );require trailingslashit( get_template_directory() ) . ‘inc/widgets/widget-random.php’;
register_widget( ‘starter_Random_Widget’ );require trailingslashit( get_template_directory() ) . ‘inc/widgets/widget-views.php’;
register_widget( ‘starter_Views_Widget’ );require trailingslashit( get_template_directory() ) . ‘inc/widgets/widget-social.php’;
register_widget( ‘starter_Social_Widget’ );require trailingslashit( get_template_directory() ) . ‘inc/widgets/widget-ad.php’;
register_widget( ‘starter_Ad_Widget’ );require trailingslashit( get_template_directory() ) . ‘inc/widgets/widget-newsletter.php’;
register_widget( ‘starter_Newsletter_Widget’ );}
add_action( ‘widgets_init’, ‘starter_widgets_init’ );/* Fix PHP warning */
function _get($str){
$val = !empty($_GET[$str]) ? $_GET[$str] : null;
return $val;
}Regards-Venu
Thanks again John for your kind & prompt response.
Except this part, my site is generally ready.
Now, the custom post type, “coupons” have a description block like normal posts & below it a block for “settings”, please see the screenshot at https://snag.gy/UjJL6V.jpg.
The Restrict Plugin settings work for the description part of these posts, but when it comes to this block that I have mentioned as per screenshot, I tried putting in the “[restrict userlevel=”editor”] . . . your restricted content goes here . . . [/restrict] shortcode, but it does not work.
I am not sure where to use this shortcode.
Kindly let me know if possible.Hey John,
Thanks for the kind response.
But my requirement is not to restrict visibility of the menu itself, which the plugin you have mentioned seems designed to do. I need access to content restricted after someone that is not logged-in tries to view the coupon posts, and prompted to login/register with my message.