New answers tagged

1

I am too late to answer this question but it will worked. $attachment_id = get_post_thumbnail_id( $post->ID ); $url = wp_get_attachment_image_src($attachment_id, 'desired-size');


1

The output is escaped, so it will not display html, try this : just save the value of the src attribute <iframe src="<?php echo esc_attr__( get_post_meta( get_the_ID(), 'name', true ) ); ?>" width="670" height="500">


0

It looks like the variable you're using to set the selected item is not defined in that scope. In your constructor: public function __construct() { if ( is_admin() ) { add_action( 'load-post.php', array( $this, 'init_metabox' ) ); add_action( 'load-post-new.php', array( $this, 'init_metabox' ) ); } ...


1

That $query->have_posts() modifies the global $post variable which is also used on the admin side, and on the front-end/public side of the site, you would simply call wp_reset_postdata() to restore the global $post back to the post before you call the $query->have_posts(). But on the admin side, you need to manually restore the variable like so, after ...


0

A possible solution is to save the $post variable before the query, like: $originalpost = $post. After the query you set the it back $post = $originalpost. I don't know of this is valid solution. But it seems to work. Thanks to @Jamie, here.


1

I get returned on the very first conditional Are you sure? Because it seems to me that it's likely the second one which verifies the nonce. if ( ! wp_verify_nonce( $_POST['_hgod_fichas_mb_nonce'], '_hgod_fichas_mb_nonce' ) ) { return; } But even if the first conditional is also exiting the function, you should know that the second parameter for ...


0

Ok silly me... I missed this crucial line: add_action( 'save_post', 'save_date_meta_box' ); It now seems to save the date values


Top 50 recent answers are included