Selecting a dynamic sidebar via metabox in wordpress

Your code seems a little superfluous; I’m pretty sure you could compact it to simply: <?php do_action( ‘before_sidebar’ ); if ( ! $sidebar = get_post_meta( get_the_ID(), ‘_cmb_test_select’, true ) ) $sidebar=”sidebar-1″; // Default sidebar if meta value does not exist. if ( ! dynamic_sidebar( $sidebar ) ) : ?> <!– No widgets for selected sidebar, … Read more

Same sidebar in all posts as in the category

Retrieving category post is assigned to is rather straightforward with get_the_category(). However note that post can be easily placed into multiple categories and you will need some (quite elaborate) logic if you want to apply any particular sorting logic to it. From looking at your code however it’s not clear how exactly category/post/sidebar are tied … Read more

unregister_sidebar in child theme not working

This line is your problem add_action( ‘widgets_init’, ‘ohsik_widgets_init’, 12); You are deregistering your sidebar correctly. For some reason you are registering it, or something. I don’t see the need or use for this. The other possibility that I’m thinking of for using this code is that somewhere you are registering your own custom sidebars. If … Read more

How to change templates based on URL

Provided not showing the sidebar is the only difference you really want between the way pages are displayed, you can load the sidebar conditionally with something like this in your page.php (or whatever file your theme is using to load the page): <?php if ( strpos($_SERVER[‘REQUEST_URI’],’/register’) == false ) { // if requested uri DOESN’T … Read more

Calling dynamic_sidebar in plugin gives error

it’s a little difficult to debug something when no errors are being displayed. i’d first check your php error logs, which normally appear in ….\logs\php_error.log or ….\logs\apache_erroe.log depending on your php.ini settings. chances of getting an immediate answer to your question will be difficult unless you can provide the actual error that’s popping up.

Include inside sidebar

If you want you can use this plugin: PHP Text Widget This allows you to use a text widget and use your choice of php codes in the text widget and achieve whatever you want. I hope this helps

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)