WordPress Website Featured Image Replacement Issue
You are offered to use: get_post_meta($post_id, $key, $single); instead of: get_thumbnail($width,$height,$classtext,$titletext,$titletext,false,’Pageimage’); and then process this meta value.
You are offered to use: get_post_meta($post_id, $key, $single); instead of: get_thumbnail($width,$height,$classtext,$titletext,$titletext,false,’Pageimage’); and then process this meta value.
I am not sure this a WordPress question. It is really more just bad PHP but since that is a filter, in the spirit of fostering good will… Your function is returning a variable-name function that doesn’t exist, and none of your operations are saved at all. You are processing the string but you aren’t … Read more
Clearly this is because the ID you are passing to get_category is wrong (false or 0). i don’t know how you configured the taxonomy add on but do a vaR_dump and double check what data the get_field function is returning, maybe it’s an array with a single value in it : get_category(array_pop(get_field(‘category_test’)));
I think all you need is this: <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> if (get_field(‘channel’) == ‘Youtube’) { echo get_field(‘youtube_video_id’); } elseif (get_field(‘channel’) == ‘Vimeo’) { echo get_field(‘vimeo_video_id’); } elseif ( has_post_thumbnail()) { the_post_thumbnail(); } That should use a Youtube video, then a Vimeo video, then the thumbnail, … Read more
the code should be instead add_shortcode( ‘faq’, ‘wpse105856_shortcode_callback’ ); function wpse105856_shortcode_callback( $atts ) { extract( shortcode_atts( array( ‘category’ => ” ), $atts ) ); $args = array( ‘numberposts’ => -1, ‘orderby’ => ‘menu_order’, ‘order’ => ‘ASC’, ‘post_type’ => ‘faq’ ); if ( ! empty( $category ) ) { $args[‘category_name’] = $category; }; $posts = get_posts( … Read more
Used normal method to get field data instead of “unserialize“ Switched this line: $album_repeatable = unserialize($post_meta_data[‘album_repeatable’][0]); to this line: $album_repeatable = get_post_meta($post->ID, ‘album_repeatable’, true); Now my repeatable field Data is being displayed. Thanks @toscho for pointing it out…
get_the_ID() is a post tag. It is meant to be used inside a Loop. Per a comment above you are using it outside the Loop. No, it’s not inside Loop. The code is simply posted within another div, which holds slides for a slideshow. get_the_ID like most post tags depends on a global variable called … Read more
<?php $ck = get_post_custom_keys($post_id); //Array foreach ($ck as $k) { if (substr ($k, 0, 1) == ‘_’) { // skip keys starting with ‘_’ continue; } $cv = get_post_custom_values($k, $post_id ); //Array foreach ($cv as $c) { if (empty ($c)) { // skip empty value continue; } echo ($k . ‘: ‘ . $c . … Read more
You can use a small SQL statement to retrieve the notes: global $wpdb; $sql = $wpdb->prepare(‘ SELECT notes FROM ‘.WPSC_TABLE_PURCHASE_LOGS.’ WHERE id=%d ‘,$item->id); echo $wpdb->get_var($sql); Read more in this post
I am trying to call external database recieving error