WordPress.org

Ready to get started?Download WordPress

Forums

Network Latest Posts
Displaying custom images linked to sites (7 posts)

  1. Chris
    Member
    Posted 1 year ago #

    Me again … :D

    Is it possible to link a custom image to each site apart from the thumbnail (which is linked to a post)?

    Here’s a little wireframe to illustrate what I mean:
    http://moargh.de/daten/network-latest-posts_example.png

    I’ve got two sites (Site name 1 and Site name 2) and of both sites the latest post is displayed. Each site has a unique logo which should be displayed on the left side.

    The logos would be uploaded via an options page on each site.

    http://wordpress.org/extend/plugins/network-latest-posts/

  2. Jose Luis SAYAGO
    Member
    Plugin Author

    Posted 1 year ago #

    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.

  3. Chris
    Member
    Posted 1 year ago #

    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
    ?>
  4. Jose Luis SAYAGO
    Member
    Plugin Author

    Posted 1 year ago #

    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?

  5. Chris
    Member
    Posted 1 year ago #

    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);
  6. Jose Luis SAYAGO
    Member
    Plugin Author

    Posted 1 year ago #

    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.

  7. Chris
    Member
    Posted 1 year ago #

    Thank you very much!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic