1

I have widget data in var $data = get_option('widget_as_about_me_widget')

The widget number is 5. How to get widget number dynamically from this array?

array(2) {
  [5]=>
  array(56) {
    ["title"]=>
    string(0) ""
    ["image_url"]=>
    string(0) ""
    ["imagealt"]=>
    string(0) ""
    ["heading"]=>
    string(0) ""
    ["sub_heading"]=>
    string(16) "fashion designer"
    ["aboutdescription"]=>
    string(122) "Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum."
    ["extended_page"]=>
    string(5) "10853"
    ["read_more_text"]=>
    string(0) ""
    ["author_facebook"]=>
    string(7) "jfghfhg"
    ["author_twitter"]=>
    string(8) "cnvnvbnv"
    ["author_google"]=>
    string(10) "nvnvnvbnvn"
    ["author_linkedin"]=>
    string(5) "gdfgf"
    ["author_tumblr"]=>
    string(0) ""
    ["author_pinterest"]=>
    string(0) ""
    ["author_youtube"]=>
    string(0) ""
    ["author_skype"]=>
    string(0) ""
    ["author_instagram"]=>
    string(0) ""
    ["author_delicious"]=>
    string(0) ""
    ["author_reddit"]=>
    string(0) ""
    ["author_stumbleupon"]=>
    string(0) ""
    ["author_wordpress"]=>
    string(0) ""
    ["author_vimeo"]=>
    string(0) ""
    ["author_flickr"]=>
    string(0) ""
    ["author_github"]=>
    string(0) ""
    ["author_stack_overflow"]=>
    string(0) ""
    ["author_xing"]=>
    string(0) ""
    ["author_foursquare"]=>
    string(0) ""
    ["author_paypal"]=>
    string(0) ""
    ["author_yelp"]=>
    string(0) ""
    ["author_soundcloud"]=>
    string(0) ""
    ["author_lastfm"]=>
    string(0) ""
    ["author_dribbble"]=>
    string(0) ""
    ["author_steam"]=>
    string(0) ""
    ["author_behance"]=>
    string(0) ""
    ["author_weibo"]=>
    string(0) ""
    ["author_renren"]=>
    string(0) ""
    ["author_dropbox"]=>
    string(0) ""
    ["author_bitbucket"]=>
    string(0) ""
    ["author_trello"]=>
    string(0) ""
    ["author_ok"]=>
    string(0) ""
    ["author_vk"]=>
    string(0) ""
    ["author_home"]=>
    string(0) ""
    ["shadow"]=>
    string(1) "1"
    ["img_border"]=>
    string(1) "1"
    ["border_width"]=>
    string(2) "15"
    ["border_color"]=>
    string(7) "#ffffff"
    ["stroke_opacity"]=>
    string(3) "0.3"
    ["select"]=>
    string(7) "hexagon"
    ["hex_flat_top"]=>
    string(1) "1"
    ["image_width"]=>
    string(3) "142"
    ["font_color"]=>
    string(7) "#939393"
    ["icon_color"]=>
    string(7) "#fcfcfc"
    ["icon_bg_color"]=>
    string(7) "#cccccc"
    ["icon_color_hover"]=>
    string(7) "#dd3333"
    ["widget_id"]=>
    string(20) "as_about_me_widget-5"
    ["aswidget_id"]=>
    string(20) "as_about_me_widget-5"
  }
  ["_multiwidget"]=>
  int(1)
}

get data from first item an associative array:

$data = array_values(get_option('widget_as_about_me_widget'))[0];

how to use:

$data['select']

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.