Different Widget Every Single Post
-
Hi,
I am after a solution to display a different widget on every single post. The site will have hundreds of posts as it’s being run as a diary/blog format, so I am after a solution bearing this in mind.I’ve tried to implement Custom Fields alongside PHP Code Widget.
In the PHP Code Widget Sidebar propety i’ve the following code:<?php if ( is_single() ) : global $post; if ( get_post_meta( $post->ID, 'per_post_content', true ) ) : echo get_post_meta( $post->ID, 'per_post_content', true ); endif; wp_reset_postdata(); endif
On every Post, I’ve got a Custom Field named ‘per_post_content’ and inside their I’ve been inserting my WP Widget Shortcode for example;
[wp_progress_bar text="Progress" text_color="#fff" background="#eee" progress_color="#bbb" pc="90" width="100%" bottom="15px"]
The widget is just blank and not displaying anything, and I am unsure if the code is wrong, or what’s the best solution to get this working.
- The topic ‘Different Widget Every Single Post’ is closed to new replies.