WordPress.org

Support

Support » Plugins and Hacks » Displaying custom images linked to sites

Displaying custom images linked to sites

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Jose Luis SAYAGO

    @iluminatus

    Hi!,

    Well it shouldn’t be difficult to tweak, but I’m wondering how are you going to display both images?.

    Right now it’s only possible to display the post thumbnail or the custom field image, not both, I guess you could adapt the plugin to display both then link the custom image to the site instead of the post.

    You may want to replace:

    echo "<a href='".$all_permalinks[$field->guid]."'>$thumb_html</a>";

    by:

    echo "<a href='".${'blog_url_'.$all_blogkeys[$field->guid]}."'>$thumb_html</a>";

    In case you want to link to the website instead of the post.

    Let me know if you need help adapting the plugin.

    Thank you for your reply!

    Unfortunately I didn’t even manage to get the custom thumbnails being displayed—not even cracked images.

    Here’s my shortcode:
    [nlposts thumbnail_custom=true thumbnail_field=custom_thumb_field]

    And I created a custom field called custom_thumb_field in my latest post where I inserted an URL to an image.

    Where did I go wrong?

    Is it possible to add an image from an options page—not from a custom field of a post? I don’t know if it helps but the value of that field can be outputted by:

    <?php
        $options = get_option('element'); // Get options of the theme called 'element'
        $color = $options['16']; // ID of the input field
        echo '$color'; // Output the value
    ?>
    Plugin Author Jose Luis SAYAGO

    @iluminatus

    Hello Chris,

    There is one parameter missing in your shortcode, thumbnail=true without it the thumbnail won’t be displayed.

    About the option, it could be done, but I need more information about those options. I see your code gets an ‘element’ which seems to be an array, is that option created by a theme or something?

    Ah, with the thumbnail=true it works, thank you!

    The code is generated by the NHP Options Framework—here’s the relevant code (shortened):

    function setup_framework_options(){
    
    	$args = array();
    
    	//Set it to dev mode to view the class settings/info in the form - default is false
    	$args['dev_mode'] = false;
    
    	//Choose a custom option name for your theme options, the default is the theme name in lowercase with spaces replaced by underscores
    	$args['opt_name'] = 'element';
    
    	//Custom page slug for options page (wp-admin/themes.php?page=***) - default is "nhp_theme_options"
    	$args['page_slug'] = 'nhp_theme_options';
    
    	//Custom page capability - default is set to "manage_options"
    	//$args['page_cap'] = 'manage_options';
    
    	//page type - "menu" (adds a top menu section) or "submenu" (adds a submenu) - default is set to "menu"
    	//$args['page_type'] = 'submenu';
    
    	//parent menu - default is set to "themes.php" (Appearance)
    	//the list of available parent menus is available here: http://codex.wordpress.org/Function_Reference/add_submenu_page#Parameters
    	//$args['page_parent'] = 'themes.php';
    
    	$sections = array();
    
    	$sections[] = array(
    					'icon' => NHP_OPTIONS_URL.'img/glyphicons/glyphicons_107_text_resize.png',
    					'title' => __('Text Fields', 'nhp-opts'),
    					'desc' => __('<p class="description">This is the Description. Again HTML is allowed2</p>', 'nhp-opts'),
    					'fields' => array(
    						array(
    							'id' => '1', //must be unique
    							'type' => 'text', //builtin fields include: text|textarea|editor|checkbox|multi_checkbox|radio|radio_img|button_set|select|multi_select|color|date|divide|info|upload
    							'title' => __('Text Option', 'nhp-opts'),
    							'sub_desc' => __('This is a little space under the Field Title in the Options table, additonal info is good in here.', 'nhp-opts')
    							),
    						array(
    							'id' => 'logo',
    							'type' => 'upload',
    							'title' => __('Logo', 'nhp-opts'),
    							'sub_desc' => __('No validation can be done on this field type', 'nhp-opts'),
    							'desc' => __('Width should be 270px.', 'nhp-opts')
    							)
    						)
    					);
    
    	}
    
    add_action('init', 'setup_framework_options', 0);
    Plugin Author Jose Luis SAYAGO

    @iluminatus

    Hi,

    Well I’m going to check what I can do about it, as soon as I have something I will let you know.

    Cheers.

    Thank you very much!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Displaying custom images linked to sites’ is closed to new replies.