Forum Replies Created

Viewing 10 replies - 1 through 10 (of 10 total)
  • Thread Starter lihao

    (@lihao)

    Is it possible to let user have the option of enabling credit links in your next update? For a lot of users, especially the academic and commercial users, it is quite crucial to have credit linked back to the original source.

    Thread Starter lihao

    (@lihao)

    I have given a positive feedback to the plugin 🙂

    Just one last question: the new version of media credit seems to have removed the link of the credit, leaving just the text there. Is there a way I could fix that?

    Thread Starter lihao

    (@lihao)

    Thank you. I have solved it 🙂

    Thread Starter lihao

    (@lihao)

    It seems to be not working though, I noticed that there is this function called

    
    function colormag_setup() {
    
    	/*
    	 * Make theme available for translation.
    	 * Translations can be filed in the /languages/ directory.
    	 */
    	load_theme_textdomain( 'colormag', get_template_directory() . '/languages' );
    
    	// Add default posts and comments RSS feed links to head
    	add_theme_support( 'automatic-feed-links' );
    
    	// This theme uses Featured Images (also known as post thumbnails) for per-post/per-page.
    	add_theme_support( 'post-thumbnails' );
    
    	// Registering navigation menu.
    	register_nav_menus(array(
          'primary' => __( 'Primary Menu', 'colormag' ),
          'footer' => __( 'Footer Menu', 'colormag' )
       ));
    
    	// Cropping the images to different sizes to be used in the theme
       add_image_size( 'colormag-highlighted-post', 392, 272, true );
       add_image_size( 'colormag-featured-post-medium', 390, 205, true );
       add_image_size( 'colormag-featured-post-small', 130, 90, true );
       add_image_size( 'colormag-featured-image', 800, 445, true );
       // Pro Options
       add_image_size( 'colormag-default-news', 150, 150, true );
       add_image_size( 'colormag-featured-image-large', 1400, 600, true );
    
    	// Setup the WordPress core custom background feature.
    	add_theme_support( 'custom-background', apply_filters( 'colormag_custom_background_args', array(
    		'default-color' => 'eaeaea'
    	) ) );
    
    	/*
        * 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 Formats.
    	add_theme_support( 'post-formats', array( 'aside', 'image', 'video', 'quote', 'link', 'gallery', 'chat', 'audio', 'status' ) );
    
    	// Adding excerpt option box for pages as well
    	add_post_type_support( 'page', 'excerpt' );
    
    	/*
    	 * 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',
    	));
    
    	// adding the WooCommerce plugin support
    	add_theme_support( 'woocommerce' );
    
    	// Adds the support for the Custom Logo introduced in WordPress 4.5
    	add_theme_support( 'custom-logo',
    		array(
    			'flex-width' => true,
    			'flex-height' => true,
    		)
    	);
    
    	// Support Auto Load Next Post plugin
    	add_theme_support('auto-load-next-post');
    }
    endif;
    

    I guess I don’t need to put the code snippet inside the function right? But there seems to be no change as the media credit is still appearing on non-post pages like http://waterpolicy.online/index.php/category/contributions/

    Thread Starter lihao

    (@lihao)

    Sorry I am pretty new to WordPress and PHP and thank you so much for your patience, not sure what I did was correct or not. I put the prevent_non_single_credits function parallel to the media_credit_shortcode function, and call it in the filter:

    
    
    /**
     * prevent credit from appearing in non-post pages 
     */
     function prevent_non_single_credits( $markup, $atts, $content ) {
        if ( ! is_single() ) {
           return $content;
        } else {
           return '';
        } 
     }
    
     function media_credit_shortcode( $atts, $content = null ) {
        $output = apply_filters( 'media_credit_shortcode', '', $atts, ‘prevent_non_single_credits’ );
    
    

    The rest of the code unchanged.

    • This reply was modified 9 years, 4 months ago by lihao.
    • This reply was modified 9 years, 4 months ago by lihao.
    • This reply was modified 9 years, 4 months ago by lihao.
    Thread Starter lihao

    (@lihao)

    Sure thank you.
    As for filtering the media credits to make it only appear in post pages, do I just add “if (!is_single()){
    return null;
    }”
    in the beginning of the media_credit_shortcode function before the rest of the existing code? Otherwise where should I do the conditioning?

    Thread Starter lihao

    (@lihao)

    Thank you for your reply. So if that’s the case, there is nothing I could do to style the credit text right?

    Thread Starter lihao

    (@lihao)

    I did not touch the media_credit_shortcode in the php file as I would like to tackle the styling issue first. You could look at http://waterpolicy.online/index.php/category/contributions/ and inspect the media credit text. It is outside the <span> tag of “media-credit”, while when I look at the source code of the web, it is inside the <span> tag.

    Thread Starter lihao

    (@lihao)

    Thread Starter lihao

    (@lihao)

    Hi Pepe,

    Thank you for your reply. I tried to change the styling of media-credit as I did not enable “display credit after posts”, but it did not work, because the credit text is not in the <span> tag with “media-credit” class, but in an tag outside the <span> tag. It only works if I directly change the css of the tag. Can I know how can I do about it?

    Thank you.

Viewing 10 replies - 1 through 10 (of 10 total)