get dynamic_sidebar() value in array in wordpress

Widgets echo data. Take a look at the widget method of some of the default widgets, like this one. You can’t save that data to an array without writing your own function to process the widgets and using output buffering where the widgets themselves echo content. And sidebars/sidebar-widgets are complicated. That is not an easy … Read more

Get array value

I think you messed up a bit. I’m assuming you’re using the ACF plugin because you used the_field(). Have you tried only the_field(‘titdesc’); if you’re in the WordPress loop? Those functions already query values stored in your postmeta table. I’m assuming you have a field called titdesc since you’re trying to read it using the_field(‘titdesc’). … Read more

Displaying an ACF list of users

You can use get_author_posts_url() or get_the_author_meta(): $values = get_field( ‘editor’ ); if ( $values ) { $editors = array(); foreach ( $values as $value ) { $link = get_author_posts_url( $value[‘ID’] ); //get the url $nicename = $value[‘user_nicename’]; $editors[] = sprintf( ‘<a href=”https://wordpress.stackexchange.com/questions/106854/%s”>%s</a>’, $link, $nicename ); //create a link for each author } echo ‘Edited by: … Read more

Inserting a random number into an array [closed]

offset parameter of get_comments() function accepts integer values for more information visit this codex page. so your get_comments function call should be as following. $numbers = array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5); $random_key = array_rand($numbers, 1); $comments = get_comments(array(‘orderby’ => ‘comment_karma’, ‘number’ => 20, ‘status’ => … Read more

Get URI from PodPress using PHP

$meta = get_post_meta(get_the_ID(), ‘_podPressMedia’, true); $meta = maybe_unserialize($meta); if (is_array($meta) && count($meta) > 0) foreach($meta as $item){ //do something… } Please, do not use unserialize/serialize with php data stored structures there is native maybe_serialize/maybe_unserialize. Retriving single value from postmeta table also doesn’t require get_post_custom, all you need to do to use get_post_meta whish will return … Read more

How to make sure relative URL works when site is not on root domain?

Make use of the functions wordpress offers to determine paths and URLs – see Determining Plugin and Content Directories. For example use: get_template_directory to Retrieves the absolute path to the directory of the current theme, without the trailing slash. or get_stylesheet_directory to Retrieve stylesheet directory Path for the current theme/child theme. You find more information … Read more