Vimeo thumbnails

Maybe this can help $videoID = the_field(‘video_link’); $jsonurl=”http://vimeo.com/api/v2/video/”.$videoID.’.json’; $json = file_get_contents($jsonurl,0,null,null); $json_output = json_decode($json,true); echo ‘<img src=”‘. $json_output[0][‘thumbnail_large’] .'” />’; It’s the same call using json method

Advanced Custom Fields functionality without plugin

I am aware of the capability of adding meta boxes for single text fields, etc, but that’s not what I am actually after. Meta fields aren’t just for “single text fields”, the database type is longtext: mysql> DESCRIBE wp_postmeta; +————+———————+——+—–+———+—————-+ | Field | Type | Null | Key | Default | Extra | +————+———————+——+—–+———+—————-+ | … Read more

how to make nsfw post with thumbanil

get_post_meta is your friend: if ( has_post_thumbnail() ) { if ( ‘yes’ == get_post_meta( $post->ID, ‘NFSWEG’, true ) ) { echo ‘<img src=”https://wordpress.stackexchange.com/questions/82422/YOUR-IMAGE-HERE”>’; } else { the_post_thumbnail( array( 400, 400, true ), array( “class” => “aligncenter featured_image” ) ); } }

$TBA Getting Translated to $0 (Custom Fields)

The problem is that you’re trying to perform a math operation on a string (‘TBA’) so the result is going to be 0. Try testing if the value is numeric by using the php function is_numeric(). You can see the docs for that function here. So in your code do this: if (is_numeric($price)) { …format … Read more

How to store post meta in an array

WordPress automatically serializes/unserializes the data when it’s stored and retrieved, all you need to do is pass a php array as your data and you’ll get the same array back when you get_post_meta. $data = array( ‘label’ => ‘something’, ‘desc’ => ‘someval’, ‘id’ => ‘someval’, ‘type’ => ‘someval’ ); update_post_meta( $post_id, ‘your_key’, $data ); $data … Read more

Correct syntax for retrieving custom field in CPT

If you have the CPT’s ID in the $event_id variable you plug into the get_post() call – why would you not simply just (re)use that for the first parameter of get_post_meta() ? That aside, get_post() returns a post object (instance of WP_Post), which you choose to assign to $event. Hence $event now has a public … Read more