Featured Image wordpress

admin98
2 Posts
admin98 posted this 26 July 2015

Hi,

Is there a setting in Themeler to make it so that featured images don't get posted in the post as well?

https://bobwp.com/exactly-what-is-that-featured-image-in-wordpress/ gives a description of the issue. So when I set a featured image (to show in a post preview) it adds it to the top left of the post. However this can't be seen in post edit and is a template issue from what I can see.

Thanks

Hi, Is there a setting in Themeler to make it so that featured images don't get posted in the post as well? https://bobwp.com/exactly-what-is-that-featured-image-in-wordpress/ gives a description of the issue. So when I set a featured image (to show in a post preview) it adds it to the top left of the post. However this can't be seen in post edit and is a template issue from what I can see. Thanks
Vote to pay developers attention to this features or issue.
7 Comments
Order By: Standard | Newest
Stagger Lee
1833 Posts
Stagger Lee posted this 27 July 2015

Click on "post content", click on image and click Delete button on keyboard. If you dont see image go over links and right click with mouse and "Open link" untill you come to one Post with featured image in content. If you dont have any Post with featured image in content area then you cannot delete it. Make one for test.

Click on "post content", click on image and click Delete button on keyboard. If you dont see image go over links and right click with mouse and "Open link" untill you come to one Post with featured image in content. If you dont have any Post with featured image in content area then you cannot delete it. Make one for test.

Last edited 27 July 2015 by Stagger Lee

admin98
2 Posts
admin98 posted this 27 July 2015

That works, but is a work around not a solution. I have created this site for someone else, who won't be using themeler. So how does it not post in the first place?

That works, but is a work around not a solution. I have created this site for someone else, who won't be using themeler. So how does it not post in the first place?
Stagger Lee
1833 Posts
Stagger Lee posted this 27 July 2015

It is WordPress way and logic. Themler has nothing to do with it. Either you echo/display featured image in detailed view, or not.

If you want customization install ACF plugin and make another image field for detailed view. Then User can decide by itself about image.

But they can already insert images with Media Modalbox and center how they will. Why do you insist on on/off featured image in post view.

It is WordPress way and logic. Themler has nothing to do with it. Either you echo/display featured image in detailed view, or not. If you want customization install ACF plugin and make another image field for detailed view. Then User can decide by itself about image. But they can already insert images with Media Modalbox and center how they will. Why do you insist on on/off featured image in post view.

Last edited 27 July 2015 by Stagger Lee

Stagger Lee
1833 Posts
Stagger Lee posted this 27 July 2015

I made something for you. I will need it very soon in the future.

  • Add this to your functions.php plugin, or in Settings of Themler (CMS Code):

<pre class>/**
* Adds a meta box to the post editing screen
*/
function prfx_featured_meta() {

add_meta_box( 'prfx_meta', __( 'Featured image in Post view', 'prfx-textdomain' ), 'prfx_meta_callback', 'post', 'side', 'high' );

}
add_action( 'add_meta_boxes', 'prfx_featured_meta' );

/**
* Outputs the content of the meta box
*/

function prfx_meta_callback( $post ) {

wp_nonce_field( basename( __FILE__ ), 'prfx_nonce' );
$prfx_stored_meta = get_post_meta( $post-&gt;ID );
?&gt;

<p>

&lt;span class="prfx-row-title"&gt;&lt;?php _e( 'Show featured image in post view', 'prfx-textdomain' )?&gt;&lt;/span&gt;
&lt;div class="prfx-row-content"&gt;
    &lt;label for="featured-checkbox"&gt;
        &lt;input type="checkbox" name="featured-checkbox" id="featured-checkbox" value="yes" &lt;?php if ( isset ( $prfx_stored_meta['featured-checkbox'] ) ) checked( $prfx_stored_meta['featured-checkbox'][0], 'yes' ); ?&gt; /&gt;
        &lt;?php _e( 'Featured Item in detailed Post view', 'prfx-textdomain' )?&gt;
    &lt;/label&gt;

&lt;/div&gt;

</p>

&lt;?php

}

/**
* Saves the custom meta input
*/
function prfx_meta_save( $post_id ) {

// Checks save status - overcome autosave, etc.
$is_autosave = wp_is_post_autosave( $post_id );
$is_revision = wp_is_post_revision( $post_id );
$is_valid_nonce = ( isset( $_POST[ 'prfx_nonce' ] ) &amp;&amp; wp_verify_nonce( $_POST[ 'prfx_nonce' ], basename( __FILE__ ) ) ) ? 'true' : 'false';

// Exits script depending on save status
if ( $is_autosave || $is_revision || !$is_valid_nonce ) {
    return;
}

// Checks for input and saves - save checked as yes and unchecked at no
if( isset( $_POST[ 'featured-checkbox' ] ) ) {

update_post_meta( $post_id, 'featured-checkbox', 'yes' );

} else {

update_post_meta( $post_id, 'featured-checkbox', 'no' );

}

}
add_action( 'save_post', 'prfx_meta_save' );

 

  • Open your Post view template in Themler. Insert CMS Code block at the top of the post content.

  • Add this in your CMS code:

<pre class>&lt;?php
$featured_image_post = get_post_meta($post-&gt;ID, 'featured-checkbox', true);
if( 'yes' == ($featured_image_post) ) { ?&gt;
&lt;!-- Do stuff if there is a value --&gt;
&lt;?php echo theme_get_post_thumbnail(array('imageClass' =&gt; ' bd-imagestyles', 'class' =&gt; ' bd-postimage')); ?&gt;
&lt;?php } else { ?&gt;
&lt;!-- Do different stuff if there isn't value --&gt;
&lt;?php } ?&gt;</pre>
 

  • Go to your CMS block options and under Style - More styles - Image - (and) More options, style image as you need.
  • You have one new metabox when adding/editing Posts in backend, right sidebar above.

I made something for you. I will need it very soon in the future. - Add this to your functions.php plugin, or in Settings of Themler (CMS Code): &lt;pre class&gt;/** * Adds a meta box to the post editing screen */ function prfx_featured_meta() { add_meta_box( 'prfx_meta', __( 'Featured image in Post view', 'prfx-textdomain' ), 'prfx_meta_callback', 'post', 'side', 'high' ); } add_action( 'add_meta_boxes', 'prfx_featured_meta' ); /** * Outputs the content of the meta box */ function prfx_meta_callback( $post ) { wp_nonce_field( basename( __FILE__ ), 'prfx_nonce' ); $prfx_stored_meta = get_post_meta( $post-&gt;ID ); ?&gt; &lt;p&gt; &lt;span class="prfx-row-title"&gt;&lt;?php _e( 'Show featured image in post view', 'prfx-textdomain' )?&gt;&lt;/span&gt; &lt;div class="prfx-row-content"&gt; &lt;label for="featured-checkbox"&gt; &lt;input type="checkbox" name="featured-checkbox" id="featured-checkbox" value="yes" &lt;?php if ( isset ( $prfx_stored_meta['featured-checkbox'] ) ) checked( $prfx_stored_meta['featured-checkbox'][0], 'yes' ); ?&gt; /&gt; &lt;?php _e( 'Featured Item in detailed Post view', 'prfx-textdomain' )?&gt; &lt;/label&gt; &lt;/div&gt; &lt;/p&gt; &lt;?php } /** * Saves the custom meta input */ function prfx_meta_save( $post_id ) { // Checks save status - overcome autosave, etc. $is_autosave = wp_is_post_autosave( $post_id ); $is_revision = wp_is_post_revision( $post_id ); $is_valid_nonce = ( isset( $_POST[ 'prfx_nonce' ] ) &amp;&amp; wp_verify_nonce( $_POST[ 'prfx_nonce' ], basename( __FILE__ ) ) ) ? 'true' : 'false'; // Exits script depending on save status if ( $is_autosave || $is_revision || !$is_valid_nonce ) { return; } // Checks for input and saves - save checked as yes and unchecked at no if( isset( $_POST[ 'featured-checkbox' ] ) ) { update_post_meta( $post_id, 'featured-checkbox', 'yes' ); } else { update_post_meta( $post_id, 'featured-checkbox', 'no' ); } } add_action( 'save_post', 'prfx_meta_save' ); &nbsp; - Open your Post view template in Themler. Insert CMS Code block at the top of the post content. - Add this in your CMS code: &lt;pre class&gt;&amp;lt;?php $featured_image_post = get_post_meta($post-&amp;gt;ID, &#39;featured-checkbox&#39;, true); if( &#39;yes&#39; == ($featured_image_post) ) { ?&amp;gt; &amp;lt;!-- Do stuff if there is a value --&amp;gt; &amp;lt;?php echo theme_get_post_thumbnail(array(&#39;imageClass&#39; =&amp;gt; &#39; bd-imagestyles&#39;, &#39;class&#39; =&amp;gt; &#39; bd-postimage&#39;)); ?&amp;gt; &amp;lt;?php } else { ?&amp;gt; &amp;lt;!-- Do different stuff if there isn&#39;t value --&amp;gt; &amp;lt;?php } ?&amp;gt;&lt;/pre&gt; &nbsp; - Go to your CMS block options and under Style - More styles - Image - (and) More options, style image as you need. - You have one new metabox when adding/editing Posts in backend, right sidebar above.
Stagger Lee
1833 Posts
Stagger Lee posted this 27 July 2015

If you do this put inside your own image size, thumbnail is not good for Post view, to small.

<?php echo theme_get_post_thumbnail(array('size' => 'post-slider', 'imageClass' => ' bd-imagestyles', 'class' => ' bd-postimage')); ?>

And if you want all featured images shown on default just up there chanke wording to "Dont show" and switch places in CMS code for stuff.

If you do this put inside your own image size, thumbnail is not good for Post view, to small. <?php echo theme_get_post_thumbnail(array('size' => 'post-slider', 'imageClass' => ' bd-imagestyles', 'class' => ' bd-postimage')); ?> And if you want all featured images shown on default just up there chanke wording to "Dont show" and switch places in CMS code for stuff.
Stagger Lee
1833 Posts
Stagger Lee posted this 27 July 2015

So simple. WordPress is joy to work with.
BTW, small offtopic. You would have pain in the head trying to do this in Joomla. What metaboxes ? What is this ?

So simple. WordPress is joy to work with. BTW, small offtopic. You would have pain in the head trying to do this in Joomla. What metaboxes ? What is this ?
dixondayana8
1 Posts
dixondayana8 posted this 2 weeks ago

Open the editor of the post or page where you want to display a unique custom header image, and locate the Featured Image module on the right. Click Set Featured Image.

Open the editor of the post or page where you want to display a unique custom header image, and locate the Featured Image module on the right. Click Set Featured Image.
You must log in or register to leave comments