WordPress.org

Forums

Types
Remove Nested DIV markup (4 posts)

  1. WeePixel
    Member
    Posted 2 years ago #

    Hi,

    I was wondering if it would be possible to remove the nested div structure when echo'ing a field?

    When I use this call ....

    <?php echo(types_render_field("sidebar-image", array("size"=>"side-thumb", "class"=>"side-thumb"))); ?>

    This structure is produced in HTML ....

    <div id="wpcf-field-sidebar-image" class="wpcf-field-image wpcf-field-sidebar-image">
    	<div class="wpcf-field-value wpcf-field-image-value wpcf-field-sidebar-image-value">
    		<img width="336" height="229" src="wp-content/uploads/2013/03/myimage.png" class="attachment-side-thumb side-thumb" alt="" style="" title="" />
    	</div>
    </div>

    This seems like a lot of markup to display a single image. Any help appreciated, thanks

    http://wordpress.org/extend/plugins/types/

  2. mbigul
    Member
    Plugin Author

    Posted 2 years ago #

    Hi WeePixel,

    Please check this tutorial for more details http://wp-types.com/documentation/functions/#Image .

    [ Signature moderated. ]

  3. WeePixel
    Member
    Posted 2 years ago #

    Hi Bigul,
    Thanks for the link and reply. However I am still having an issue.

    When i use this call

    <?php echo(types_render_field("sidebar-image", array("size"=>"side-thumb"))); ?>

    I can get the IMG tag output without the div markup. When I try to add a class using this call ...

    <?php echo(types_render_field("sidebar-image", array("size"=>"side-thumb", "class"=>"side-thumb"))); ?>

    the IMG tag is output with the additional DIV markup ( below ).. is this a bug or am I missing something - I am using Types - Complete Solution for Custom Fields and Types - Version 1.1.3.4

    <div id="wpcf-field-sidebar-image-2" class="wpcf-field-image wpcf-field-sidebar-image">
    	<div class="wpcf-field-value wpcf-field-image-value wpcf-field-sidebar-image-value">
    		<img width="336" height="229" src="wp-content/uploads/2013/03/myimage.png" class="attachment-side-thumb side-thumb" alt="" style="" title="" />
    	</div>
    </div>

    Again any help appreciated, thanks

  4. mbigul
    Member
    Plugin Author

    Posted 2 years ago #

    Hi WeePixel,

    Size parameter value must be one of these ‘thumbnail’,'medium’,'large’ or 'full’. Please check tutorial for more details http://wp-types.com/documentation/functions/#Image

    Please let me know what will be result of following code. If issue exist please upgrade to Latest version Types 1.2.1.2(After taking a backup)and try.

    <?php echo(types_render_field("sidebar-image", array("class"=>"side-thumb"))); ?>

    Hope your WordPress version is 3.5.1.

    [ Signature moderated. ]

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Types
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic