How to use variables from widgets in other pages?
If you save those urls in options table, then using get_option you can use it any where…
If you save those urls in options table, then using get_option you can use it any where…
EDIT $thisid can be passed as an array, as get_post_anscestors(). So try $ancestors = get_post_ancestors( array( $thisid ) ); I misread; it does accept strings, but maybe give an array a shot.
You can get the queried author in author.php with get_queried_object(): $author = get_queried_object(); echo $author->ID; $author_data = get_object_vars( $author->data ); echo $author_data[‘display_name’]; echo $author_data[‘user_url’]; echo $author_data[‘user_email’];
My initial thought without being able to do further testing is that your custom galleri page is looking for the URL parameters in order to determine which post to pull images from. However, since you’re rewriting the URL, those URL parameters don’t technically exist (I could be wrong about this – I’m not at a … Read more
Generally, you cannot access local variables in a function from outside the function, so this… function func() { $var = 2; } $var = 1; func(); echo $var; would result in “1”. To make a global variable, you can do this to make $option available outside functions.php: function func() { global $option; $option = get_option( … Read more
You have to declare the closure before you call add_menu_page(): $func = function() { echo “Done !”; }; add_menu_page(‘My page’,’My page’,’manage_options’,’my_page’, $func ); Note you need PHP 5.3 to do that.
Have you tried setting the output of the first do_shortcode inside the second call? $output = do_shortcode(‘[first_shortcode]Some content[/first_shortcode]’); echo do_shortcode(‘[second_shortcode]’.$output.'[/second_shortcode]’);
To answer your question directly, yes, $wpdb is “auto loaded and set up to global by WordPress” but by loading wp-content/themes/roots/script.php directly you are skipping over the WordPress boot process and loading the file exactly as if WordPress did not exist. That is why the normal WordPress objects and constants aren’t available. They haven’t been … Read more
Well, for me the problem, was including during the post content it would not work, but if i did included in the top of the page template model i created, then it would work if i used something like this: VALID FOR PHP 5.3+ $array = array(“keywords” => “keywords here”, “description” => “desc here”); add_action( … Read more
First of all, it’s best not to include wp-blog-header.php. Instead, set the cron job to your homepage URL with a ?mycustomcron=true variable appended (eg: http://example.com/?mycustomcron=true. Then we will check for the existance of this variable when the page loads: function wpse_103127_check_cron() { if ( isset( $_GET[‘mycustomcron’] ) ) { // things to do on cron … Read more