public function render_content() { $llorix_one_all_pages_array = array(); // new array with all pages $llorix_one_all_pages = get_pages(); // get all pages if (!empty($llorix_one_all_pages)) { $llorix_one_all_pages_array[0] = "-- Select --"; foreach ($llorix_one_all_pages as $llorix_one_page) { if (!empty($llorix_one_page->ID) && !empty($llorix_one_page->post_title)) { $llorix_one_all_pages_array[$llorix_one_page->ID] = $llorix_one_page->post_title; } } } if (!empty($llorix_one_all_pages_array)) { // change the frontpage control with the new array echo '<label>'; echo '<span class="customize-control-title">' . esc_html($this->label) . '</span>'; echo '<select data-customize-setting-link="page_on_front" name="_customize-dropdown-pages-page_on_front" id="_customize-dropdown-pages-page_on_front">'; foreach ($llorix_one_all_pages_array as $llorix_one_all_pages_array_k => $llorix_one_all_pages_array_v) { $llorix_one_page_template = get_page_template_slug($llorix_one_all_pages_array_k); if (!empty($llorix_one_page_template)) { echo '<option value="' . $llorix_one_all_pages_array_k . '" template="' . $llorix_one_page_template . '">' . $llorix_one_all_pages_array_v . '</option>'; } else { echo '<option value="' . $llorix_one_all_pages_array_k . '" template="default">' . $llorix_one_all_pages_array_v . '</option>'; } } echo '</select>'; echo '</label>'; } }
public function form_membership_level($id) { ob_start(); $id = $_POST['id']; $wpm_levels = $this->wlm->GetOption('wpm_levels'); $level = $wpm_levels[$id]; $pages = get_pages('exclude=' . implode(',', $this->wlm->ExcludePages(array(), true))); $pages_options = ''; foreach ((array) $pages as $page) { $pages_options .= '<option value="' . $page->ID . '">' . $page->post_title . '</option>'; } $roles = $GLOBALS['wp_roles']->roles; $caps = array(); foreach ((array) $roles as $key => $role) { if ($role['capabilities']['level_10'] || $role['capabilities']['level_9'] || $role['capabilities']['level_8']) { unset($roles[$key]); } else { list($roles[$key]) = explode('|', $role['name']); $caps[$key] = count($role['capabilities']); } } array_multisort($caps, SORT_ASC, $roles); include $this->wlm->pluginDir . '/resources/forms/edit_membership_level.php'; $str = ob_get_clean(); echo $str; //return $str; die; }
/** * Defines an array of options that will be used to generate the settings page and be saved in the database. * When creating the "id" fields, make sure to use all lowercase and no spaces. * */ function optionsframework_options() { // Test data $test_array = array("one" => "One", "two" => "Two", "three" => "Three", "four" => "Four", "five" => "Five"); // Multicheck Array $multicheck_array = array("one" => "French Toast", "two" => "Pancake", "three" => "Omelette", "four" => "Crepe", "five" => "Waffle"); // Multicheck Defaults $multicheck_defaults = array("one" => "1", "five" => "1"); // Background Defaults $background_defaults = array('color' => '', 'image' => '', 'repeat' => 'repeat', 'position' => 'top center', 'attachment' => 'scroll'); // Pull all the categories into an array $options_categories = array(); $options_categories_obj = get_categories(); foreach ($options_categories_obj as $category) { $options_categories[$category->cat_ID] = $category->cat_name; } // Pull all the pages into an array $options_pages = array(); $options_pages_obj = get_pages('sort_column=post_parent,menu_order'); $options_pages[''] = 'Select a page:'; foreach ($options_pages_obj as $page) { $options_pages[$page->ID] = $page->post_title; } // If using image radio buttons, define a directory path $imagepath = get_bloginfo('stylesheet_directory') . '/admin/images/'; $options_menu_page = array('name' => 'general', 'pagename' => 'general-options', 'title' => 'General Settings'); $options = array(); $options = array(array("name" => "Basic Settings", "type" => "heading"), array("name" => "Input Text Mini", "desc" => "A mini text input field.", "id" => "example_text_mini", "std" => "Default", "class" => "mini", "type" => "text"), array("name" => "Input Text", "desc" => "A text input field.", "id" => "example_text", "std" => "Default Value", "type" => "text"), array("name" => "Textarea", "desc" => "Textarea description.", "id" => "example_textarea", "std" => "Default Text", "type" => "textarea"), array("name" => "Input Select Small", "desc" => "Small Select Box.", "id" => "example_select", "std" => "three", "type" => "select", "class" => "mini", "options" => $test_array), array("name" => "Input Select Wide", "desc" => "A wider select box.", "id" => "example_select_wide", "std" => "two", "type" => "select", "options" => $test_array), array("name" => "Select a Category", "desc" => "Passed an array of categories with cat_ID and cat_name", "id" => "example_select_categories", "type" => "select", "options" => $options_categories), array("name" => "Select a Page", "desc" => "Passed an pages with ID and post_title", "id" => "example_select_pages", "type" => "select", "options" => $options_pages), array("name" => "Input Radio (one)", "desc" => "Radio select with default options 'one'.", "id" => "example_radio", "std" => "one", "type" => "radio", "options" => $test_array), array("name" => "Example Info", "desc" => "This is just some example information you can put in the panel.", "type" => "info"), array("name" => "Input Checkbox", "desc" => "Example checkbox, defaults to true.", "id" => "example_checkbox", "std" => "1", "type" => "checkbox"), array("name" => "Advanced Settings", "type" => "heading"), array("name" => "Check to Show a Hidden Text Input", "desc" => "Click here and see what happens.", "id" => "example_showhidden", "type" => "checkbox"), array("name" => "Hidden Text Input", "desc" => "This option is hidden unless activated by a checkbox click.", "id" => "example_text_hidden", "std" => "Hello", "class" => "hidden", "type" => "text"), array("name" => "Uploader Test", "desc" => "This creates a full size uploader that previews the image.", "id" => "example_uploader", "type" => "upload"), array("name" => "Example Image Selector", "desc" => "Images for layout.", "id" => "example_images", "std" => "2c-l-fixed", "type" => "images", "options" => array('1col-fixed' => $imagepath . '1col.png', '2c-l-fixed' => $imagepath . '2cl.png', '2c-r-fixed' => $imagepath . '2cr.png')), array("name" => "Example Background", "desc" => "Change the background CSS.", "id" => "example_background", "std" => $background_defaults, "type" => "background"), array("name" => "Multicheck", "desc" => "Multicheck description.", "id" => "example_multicheck", "std" => $multicheck_defaults, "type" => "multicheck", "options" => $multicheck_array), array("name" => "Colorpicker", "desc" => "No color selected by default.", "id" => "example_colorpicker", "std" => "", "type" => "color"), array("name" => "Typography", "desc" => "Example typography.", "id" => "example_typography", "std" => array('size' => '12px', 'face' => 'verdana', 'style' => 'bold italic', 'color' => '#123456'), "type" => "typography")); return $options; }
public function get_pages($pages, $args) { $language = empty($args['lang']) ? $this->curlang : $this->model->get_language($args['lang']); if (empty($language) || empty($pages) || !$this->model->is_translated_post_type($args['post_type'])) { return $pages; } static $once = false; // obliged to redo the get_pages query if we want to get the right number if (!empty($args['number']) && !$once) { $once = true; // avoid infinite loop $r = array('lang' => 0, 'numberposts' => -1, 'nopaging' => true, 'post_type' => $args['post_type'], 'fields' => 'ids', 'tax_query' => array(array('taxonomy' => 'language', 'field' => 'term_taxonomy_id', 'terms' => $language->term_taxonomy_id, 'operator' => 'NOT IN'))); $args['exclude'] = array_merge($args['exclude'], get_posts($r)); $pages = get_pages($args); } $ids = wp_list_pluck($pages, 'ID'); // filters the queried list of pages by language if (!$once) { $ids = array_intersect($ids, $this->model->get_objects_in_language($language)); foreach ($pages as $key => $page) { if (!in_array($page->ID, $ids)) { unset($pages[$key]); } } } // not done by WP but extremely useful for performance when manipulating taxonomies update_object_term_cache($ids, $args['post_type']); $once = false; // in case get_pages is called another time return $pages; }
function oblivion_pg() { $pages = get_pages(array('meta_key' => '_wp_page_template', 'meta_value' => 'tmp-blog.php')); foreach ($pages as $page) { return $page->post_name; } }
/** * This code generates the angularjs html views templates * It uses HTTP-API with wp_remote_get() * */ function angp_get_template_content($new_status, $old_status) { global $post; if (isset($post->post_name)) { $post_slug = $post->post_name; $file = get_template_directory() . '/library/views/pages/' . $post_slug . '.html'; if ($old_status != 'trash' && $new_status == 'trash') { if (file_exists($file)) { unlink($file); } } } if ($old_status != 'publish' && $new_status == 'publish' || did_action('wp_insert_post') === 1) { angp_get_page_http_api(site_url(), 'newsloop'); $pages = get_pages(array('sort_order' => 'asc')); if (!empty($pages)) { foreach ($pages as $page) { $slug = $page->post_name; $url = get_page_link($page->ID); angp_set_session('index.php', 'template_req'); angp_get_page_http_api($url, $slug); } } } }
function wpbss_main_menu_fallback() { global $post; $args = array('post_type' => 'page', 'post_status' => 'publish', 'hierarchical' => 0); $pages = get_pages($args); //var_dump($pages); ?> <ul class="nav navbar-nav"> <?php foreach ($pages as $post) { setup_postdata($post); ?> <li> <a href="<?php the_permalink(); ?> "><?php echo $post->post_title; ?> </a> </li> <?php } wp_reset_postdata(); ?> </ul> <?php }
function theme_get_excluded_pages() { $excluded_pages = theme_get_option('general', 'excluded_pages'); $home = theme_get_option('homepage', 'home_page'); if (!empty($excluded_pages)) { //Exclude a parent and all of that parent's child Pages $excluded_pages_with_childs = ''; foreach ($excluded_pages as $parent_page_to_exclude) { if ($excluded_pages_with_childs) { $excluded_pages_with_childs .= ',' . $parent_page_to_exclude; } else { $excluded_pages_with_childs = $parent_page_to_exclude; } $descendants = get_pages('child_of=' . $parent_page_to_exclude); if ($descendants) { foreach ($descendants as $descendant) { $excluded_pages_with_childs .= ',' . $descendant->ID; } } } if ($home) { $excluded_pages_with_childs .= ',' . $home; } } else { $excluded_pages_with_childs = $home; } return $excluded_pages_with_childs; }
function getChildPagesList($id) { // Get the child pages of the current page. $args = array('child_of' => $id, 'sort_column' => 'menu_order', 'echo' => 0); $pages = get_pages($args); // Build the page list $class = ''; $option = '<ul class="sub nav">'; foreach ($pages as $pagg) { if (is_page($pagg->ID)) { $class = ' class="active"'; } $option .= '<li' . $class . '>'; $pageRedirect = get_field('redirect', $pagg->ID); if ($pageRedirect && $pageRedirect != 'no') { $option .= '<a href="' . $pageRedirect . '">' . $pagg->post_title . '</a>'; } else { $option .= '<a href="' . get_page_link($pagg->ID) . '">' . $pagg->post_title . '</a>'; } $option .= '</li>'; $class = ''; } $option .= '</ul>'; // Return list return $option; }
public function widget($args, $instance) { extract($args); $id = $this->get_post_top_ancestor_id(); if (!count(get_pages("child_of={$id}"))) { return; } $title = '<a href="' . get_permalink($id) . '" title="' . esc_attr(strip_tags(get_the_title($id))) . '">' . get_the_title($id) . '</a>'; $depth = isset($instance['depth']) ? $instance['depth'] : 1; echo $before_widget; ?> <?php echo $before_title . $title . $after_title; ?> <?php echo '<ul class="menu">'; ?> <?php wp_list_pages(array('title_li' => '', 'depth' => $depth, 'child_of' => $id)); ?> <?php echo '</ul>'; ?> <?php echo $after_widget; }
public function get_cf7_pages() { $args = array('sort_order' => 'ASC', 'sort_column' => 'post_title', 'post_type' => 'page', 'post_status' => 'publish'); // get the list of pages $pages = get_pages($args); return $pages; }
function has_children() { global $post; //get the array of pages which are the child of given post $pages = get_pages('child_of=' . $post->ID); return count($pages); }
function wdp_options() { // VARIABLES $theme_data = get_theme_data(STYLESHEETPATH . '/style.css'); $themename = $theme_data['Name']; $themeversion = $theme_data['Version']; $shortname = "tz"; // Populate option in array for use in theme global $wdp_options; $wdp_options = get_option('wdp_options'); $GLOBALS['template_path'] = wdp_DIRECTORY; //Access the WordPress Categories via an Array $wdp_categories = array(); $wdp_categories_obj = get_categories('hide_empty=0'); foreach ($wdp_categories_obj as $wdp_cat) { $wdp_categories[$wdp_cat->cat_ID] = $wdp_cat->cat_name; } $categories_tmp = array_unshift($wdp_categories, "Select a category:"); //Access the WordPress Pages via an Array $wdp_pages = array(); $wdp_pages_obj = get_pages('sort_column=post_parent,menu_order'); foreach ($wdp_pages_obj as $wdp_page) { $wdp_pages[$wdp_page->ID] = $wdp_page->post_name; } $wdp_pages_tmp = array_unshift($wdp_pages, "Select a page:"); // Image Alignment radio box $options_thumb_align = array("alignleft" => "Left", "alignright" => "Right", "aligncenter" => "Center"); // Image Links to Options $options_image_link_to = array("image" => "The Image", "post" => "The Post"); //Stylesheets Reader $alt_stylesheet_path = wdp_FILEPATH . '/css/'; $alt_stylesheets = array(); if (is_dir($alt_stylesheet_path)) { if ($alt_stylesheet_dir = opendir($alt_stylesheet_path)) { while (($alt_stylesheet_file = readdir($alt_stylesheet_dir)) !== false) { if (stristr($alt_stylesheet_file, ".css") !== false) { $alt_stylesheets[] = $alt_stylesheet_file; } } } } //More Options $uploads_arr = wp_upload_dir(); $all_uploads_path = ''; if (isset($uploads_arr['path'])) { $all_uploads_path = $uploads_arr['path']; } $all_uploads = get_option('wdp_uploads'); $other_entries = array("Select a number:", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19"); // Set the Options Array $options = array(); $options[] = array("name" => __('Background Images', 'framework'), "type" => "heading"); $options[] = array("name" => "", "message" => __('Here, you can change the background images. Use an image resolution of 1280px X 800px ~ 200 KB, if possible.', 'framework'), "type" => "intro"); $options[] = array("name" => __('Background Image 1', 'framework'), "desc" => __('Upload a logo for your theme, or specify the image address of your online logo. (http://example.com/logo.png)', 'framework'), "id" => $shortname . "_bg_image_1", "std" => "", "type" => "upload"); $options[] = array("name" => __('Background Image 2', 'framework'), "desc" => __('Upload a logo for your theme, or specify the image address of your online logo. (http://example.com/logo.png)', 'framework'), "id" => $shortname . "_bg_image_2", "std" => "", "type" => "upload"); $options[] = array("name" => __('Background Image 3', 'framework'), "desc" => __('Upload a logo for your theme, or specify the image address of your online logo. (http://example.com/logo.png)', 'framework'), "id" => $shortname . "_bg_image_3", "std" => "", "type" => "upload"); update_option('wdp_template', $options); update_option('wdp_themename', $themename); update_option('wdp_shortname', $shortname); }
public function child_nav_pagination($parent = null) { global $post; if ($post->post_parent == 0) { $children = get_pages(array('sort_column' => 'menu_order', 'sort_order' => 'asc', 'post__in' => array(12, 14, 10, 8, 5))); $pages = array(); foreach ($children as $page) { $pages[] += $page->ID; } $prev = ""; $next = array_key_exists(0, $pages) ? $pages[0] : ""; return array('next' => $next, 'prev' => $prev); } else { $child = $post->ID; $parent = null !== $parent ? $parent : $post->post_parent; $children = get_pages(array('sort_column' => 'menu_order', 'sort_order' => 'ASC', 'post__in' => array(12, 14, 10, 8, 5))); $pages = array($parent); foreach ($children as $page) { $pages[] += $page->ID; } if (!in_array($child, $pages) && !is_page($parent)) { return; } $current = array_search($child, $pages); $prev = array_key_exists($current - 1, $pages) ? $pages[$current - 1] : ""; $next = array_key_exists($current + 1, $pages) ? $pages[$current + 1] : ""; return array('next' => $next, 'prev' => $prev); } }
function walk_page($page_id) { global $page_depth; $args = array(); $page_lists = array(); if ($page_depth == 0) { $page_lists[] = __('-Select-'); } if ($page_id > 0) { $args['child_of'] = $page_id; } else { $args['parent'] = 0; } $pages = get_pages($args); $str = str_repeat('→', $page_depth); if ($pages && !is_wp_error($pages)) { foreach ($pages as $page) { $page_lists[$page->ID] = $str . $page->post_title; $child = walk_page($page->ID); $child = array_filter($child); foreach ($child as $kid_id => $kid_title) { $page_lists[$kid_id] = $kid_title; } } } if ($page_id > 0 && count($page_lists) > 0 && $page_depth == 0) { $page_depth++; } return $page_lists; }
/** * Metabox for Children of Parent ID * @author Kenneth White (GitHub: sprclldr) * @link https://github.com/WebDevStudios/CMB2/wiki/Adding-your-own-show_on-filters * * @param bool $display * @param array $meta_box * @return bool display metabox */ function be_metabox_show_on_child_of($display, $meta_box) { if (!isset($meta_box['show_on']['key'], $meta_box['show_on']['value'])) { return $display; } if ('child_of' !== $meta_box['show_on']['key']) { return $display; } $post_id = 0; // If we're showing it based on ID, get the current ID if (isset($_GET['post'])) { $post_id = $_GET['post']; } elseif (isset($_POST['post_ID'])) { $post_id = $_POST['post_ID']; } if (!$post_id) { return $display; } $pageids = array(); foreach ((array) $meta_box['show_on']['value'] as $parent_id) { $pages = get_pages(array('child_of' => $parent_id, 'post_status' => 'publish,draft,pending')); if ($pages) { foreach ($pages as $page) { $pageids[] = $page->ID; } } } $pageids_unique = array_unique($pageids); echo '<p>made it here</p>'; return in_array($post_id, $pageids_unique); }
function pagecontent_admin_head() { //All pages IDs and titles $pages_data = get_pages(); $pages = "["; foreach ($pages_data as $page) { $pages .= "{text:'" . $page->post_title . "', value:'" . $page->ID . "'}, "; } //All posts IDs and titles $pages_data = get_posts(); foreach ($pages_data as $page) { $pages .= "{text:'" . $page->post_title . "', value:'" . $page->ID . "'}, "; } $pages .= "]"; ?> <!-- TinyMCE Shortcode GekoPageContent --> <script type='text/javascript'> var geko_pagecontent_ids = <?php echo $pages; ?> ; </script> <!-- TinyMCE Shortcode GekoPageContent --> <?php }
function bizway_options() { // VARIABLES $themename = get_theme_data(get_template_directory() . '/style.css'); $themename = $themename['Name']; $shortname = "of"; // Populate OptionsFramework option in array for use in theme global $of_options; $of_options = bizway_get_option('of_options'); // Background Defaults $background_defaults = array('color' => '', 'image' => '', 'repeat' => 'repeat', 'position' => 'top center', 'attachment' => 'scroll'); //Front page on/off $file_rename = array("on" => "On", "off" => "Off"); //Stylesheet Reader $alt_stylesheets = array("default" => "default", "blue" => "blue", "coffee" => "coffee", "green" => "green", "brown" => "brown", "pink" => "pink", "orange" => "orange", "purple" => "purple", "red" => "red", "forrest-green" => "forrest-green", "yellow" => "yellow"); // Pull all the categories into an array $options_categories = array(); $options_categories_obj = get_categories(); foreach ($options_categories_obj as $category) { $options_categories[$category->cat_ID] = $category->cat_name; } // Pull all the pages into an array $options_pages = array(); $options_pages_obj = get_pages('sort_column=post_parent,menu_order'); $options_pages[''] = 'Select a page:'; foreach ($options_pages_obj as $page) { $options_pages[$page->ID] = $page->post_title; } // If using image radio buttons, define a directory path $imagepath = get_stylesheet_directory_uri() . '/images/'; $options = array(array("name" => "General Settings", "type" => "heading"), array("name" => "Custom Logo", "desc" => "Choose your own logo. Optimal Size: 300px Wide by 90px Height.", "id" => "bizway_logo", "type" => "upload"), array("name" => "Custom Favicon", "desc" => "Specify a 16px x 16px image that will represent your website's favicon.", "id" => "bizway_favicon", "type" => "upload"), array("name" => "Tracking Code", "desc" => "Paste your Google Analytics (or other) tracking code here.", "id" => "bizway_analytics", "std" => "", "type" => "textarea"), array("name" => "Homepage Settings", "type" => "heading"), array("name" => "First Heading", "desc" => "Enter your text for first heading.", "id" => "bizway_first_head", "std" => "", "type" => "textarea"), array("name" => "Second Heading", "desc" => "Enter your text for second heading.", "id" => "bizway_second_head", "std" => "", "type" => "textarea"), array("name" => "Slider Settings", "type" => "heading"), array("name" => "Slider Image1", "desc" => "Choose your image for first slider. Optimal size is 950px wide and 350px height.", "id" => "bizway_slideimage1", "std" => "", "type" => "upload"), array("name" => "Slide 1 Link", "desc" => "Enter your link url for slide1", "id" => "bizway_slidelink1", "std" => "", "type" => "text"), array("name" => "Slider Image2", "desc" => "Choose your image for second slider. Optimal size is 950px wide and 350px height.", "id" => "bizway_slideimage2", "std" => "", "type" => "upload"), array("name" => "Slide 2 Link", "desc" => "Enter your link url for slide2", "id" => "bizway_slidelink2", "std" => "", "type" => "text"), array("name" => "Homepage Feature Area", "type" => "heading"), array("name" => "Homepage Feature Area First Image", "desc" => "Choose your image for homepage feature area first image.", "id" => "bizway_featureimg1", "std" => "", "type" => "upload"), array("name" => "First Feature Heading", "desc" => "Enter your text for first col heading.", "id" => "bizway_firsthead", "std" => "", "type" => "textarea"), array("name" => "First Feature Description", "desc" => "Enter your text for first col description.", "id" => "bizway_firstdesc", "std" => "", "type" => "textarea"), array("name" => "First Feature Link URL", "desc" => "Enter your link url for fourth feature section.", "id" => "bizway_link1", "std" => "", "type" => "text"), array("name" => "Second Feature Starts From Here.", "type" => "saperate", "class" => "saperator"), array("name" => "Homepage Feature Area Second Image", "desc" => "Choose your image for homepage Feature area second image.", "id" => "bizway_featureimg2", "std" => "", "type" => "upload"), array("name" => "Second Feature Heading", "desc" => "Enter your text for second col heading.", "id" => "bizway_secondhead", "std" => "", "type" => "textarea"), array("name" => "Second Col Description", "desc" => "Enter your text for second col description.", "id" => "bizway_seconddesc", "std" => "", "type" => "textarea"), array("name" => "Second Feature Link URL", "desc" => "Enter your link url for fourth feature section.", "id" => "bizway_link2", "std" => "", "type" => "text"), array("name" => "Third Feature Starts From Here.", "type" => "saperate", "class" => "saperator"), array("name" => "Homepage Third Feature Image", "desc" => "Choose your image for homepage Feature area third image.", "id" => "bizway_featureimg3", "std" => "", "type" => "upload"), array("name" => "Third Feature Heading", "desc" => "Enter your text for second col heading.", "id" => "bizway_thirdhead", "std" => "", "type" => "textarea"), array("name" => "Third Feature Description", "desc" => "Enter your text for Third Feature description.", "id" => "bizway_thirddesc", "std" => "", "type" => "textarea"), array("name" => "Third Feature Link URL", "desc" => "Enter your link url for fourth feature section.", "id" => "bizway_link3", "std" => "", "type" => "text"), array("name" => "Styling Options", "type" => "heading"), array("name" => "Custom CSS", "desc" => "Quickly add some CSS to your theme by adding it to this block.", "id" => "bizway_customcss", "std" => "", "type" => "textarea")); bizway_update_option('of_template', $options); bizway_update_option('of_themename', $themename); bizway_update_option('of_shortname', $shortname); }
/** * [__construct description] */ public function __construct() { /** * Init vendors array */ $this->create_third_party_array(); /** * Get all posts and pages object and merge for jQuery autocomplete function */ // $this->get_post_and_page_array(); $this->post_and_page_array = is_array(get_pages('numberposts=-1')) ? get_pages('numberposts=-1') : array(); /** * Add Admin menù page */ add_action('admin_menu', array($this, 'addMenuPage')); /** * Init settings */ add_action('admin_init', array($this, 'italy_cl_settings_init')); /** * Load script only if is Italy Cookie Choices admin panel */ if (isset($_GET['page']) && $_GET['page'] === 'italy-cookie-choices') { add_action('admin_enqueue_scripts', array($this, 'add_script_and_style')); } /** * Add link in plugin activation panel */ add_filter('plugin_action_links_' . ITALY_COOKIE_CHOICES_BASENAME, array($this, 'plugin_action_links')); //Add the export settings method add_action('admin_init', array($this, 'settings_export')); //Add the import settings method add_action('admin_init', array($this, 'settings_import')); }
/** * Add rewrite rules for Eventbrite views. * * @access public * * @param array $wp_rules WordPress rewrite rules. * @return array All rewrite rules (WordPress and Eventbrite rules combined). */ public function add_rewrite_rules($wp_rules) { $eb_rules = array(); // Get all pages that are using the Eventbrite page template. $pages = get_pages(array('meta_key' => '_wp_page_template', 'meta_value' => 'eventbrite-index.php')); // If any pages are using the template, add rewrite rules for each of them. if ($pages) { foreach ($pages as $page) { // Add rules for "author" archives (meaning all events by an organizer). $eb_rules_key = sprintf('(%s)/organizer/[0-9a-z-]+-(\\d+)/?$', $page->post_name); $eb_rules[$eb_rules_key] = 'index.php?pagename=$matches[1]&organizer_id=$matches[2]'; $eb_rules_key = sprintf('(%s)/organizer/[0-9a-z-]+-(\\d+)/page/([0-9]{1,})/?$', $page->post_name); $eb_rules[$eb_rules_key] = 'index.php?pagename=$matches[1]&organizer_id=$matches[2]&paged=$matches[3]'; // Add rules for venue archives (meaning all events at a given venue). $eb_rules_key = sprintf('(%s)/venue/[0-9a-z-]+-(\\d+)/?$', $page->post_name); $eb_rules[$eb_rules_key] = 'index.php?pagename=$matches[1]&venue_id=$matches[2]'; $eb_rules_key = sprintf('(%s)/venue/[0-9a-z-]+-(\\d+)/page/([0-9]{1,})/?$', $page->post_name); $eb_rules[$eb_rules_key] = 'index.php?pagename=$matches[1]&venue_id=$matches[2]&paged=$matches[3]'; // Add a rule for event single views. Event IDs are 11 digits long (for the foreseeable future). $eb_rules_key = sprintf('(%s)/[0-9a-z-]+-(\\d{11})/?$', $page->post_name); $eb_rules[$eb_rules_key] = 'index.php?pagename=$matches[1]&eventbrite_id=$matches[2]'; } } // Combine all rules and return. $rules = array_merge($eb_rules + $wp_rules); return $rules; }
function nav_menu_add_classes2($items, $args) { //print_r($items); global $post; $i = 0; $j = false; $a = false; foreach ($items as $item) { $i++; if (is_single() && get_post_type() == 'interesting-fact') { //get parent page ID by checking which page uses interesting fatcs page template $pages = get_pages(array('meta_key' => '_wp_page_template', 'meta_value' => 'page-templates/interesting_facts.php', 'lang' => pll_current_language('slug'))); $parent_page_id = $pages[0]->ID; if ($item->object_id == $parent_page_id) { // $item->classes[] = 'current_page_parent'; $item->classes[] = 'current_menu_item'; $j = $i - 1; $a = $item->ID; } } } if ($j) { // $items[$j]->classes[] = 'current_page_parent'; $items[1]->classes[] = 'current_page_ancestor'; } if ($a) { echo $a; } return $items; }
/** * Define our form fields (settings) * * @return array */ function silencio_options_page_fields() { // Text Form Fields section $options[] = array("section" => "theme_options", "id" => SILENCIO_SHORTNAME . "street_txt_input", "label" => __('Street Address', 'silencio'), "type" => "text"); $options[] = array("section" => "theme_options", "id" => SILENCIO_SHORTNAME . "city_txt_input", "label" => __('City', 'silencio'), "type" => "text"); $options[] = array("section" => "theme_options", "id" => SILENCIO_SHORTNAME . "state_txt_input", "label" => __('State', 'silencio'), "type" => "text"); $options[] = array("section" => "theme_options", "id" => SILENCIO_SHORTNAME . "zip_txt_input", "label" => __('Zip Code', 'silencio'), "type" => "text", "sanitize_callback" => "silencio_zip"); $options[] = array("section" => "theme_options", "id" => SILENCIO_SHORTNAME . "phone_txt_input", "label" => __('Phone Number', 'silencio'), "type" => "text"); $options[] = array("section" => "theme_options", "id" => SILENCIO_SHORTNAME . "fax_txt_input", "label" => __('Fax Number', 'silencio'), "type" => "text"); $options[] = array("section" => "theme_options", "id" => SILENCIO_SHORTNAME . "facebook_txt_input", "label" => __('Facebook Link', 'silencio'), "type" => "text", "sanitize_callback" => "silencio_url"); $options[] = array("section" => "theme_options", "id" => SILENCIO_SHORTNAME . "twitter_txt_input", "label" => __('Twitter Link', 'silencio'), "type" => "text", "sanitize_callback" => "silencio_url"); $options[] = array("section" => "theme_options", "id" => SILENCIO_SHORTNAME . "youtube_txt_input", "label" => __('YouTube Link', 'silencio'), "type" => "text", "sanitize_callback" => "silencio_url"); $options[] = array("section" => "theme_options", "id" => SILENCIO_SHORTNAME . "googleplus_txt_input", "label" => __('Google Plus Link', 'silencio'), "type" => "text", "sanitize_callback" => "silencio_url"); $options[] = array("section" => "theme_options", "id" => SILENCIO_SHORTNAME . "linkedin_txt_input", "label" => __('LinkedIn Link', 'silencio'), "type" => "text", "sanitize_callback" => "silencio_url"); $options[] = array("section" => "theme_options", "id" => SILENCIO_SHORTNAME . "instagram_txt_input", "label" => __('Instagram Link', 'silencio'), "type" => "text", "sanitize_callback" => "silencio_url"); $options[] = array("section" => "theme_options", "id" => SILENCIO_SHORTNAME . "email_txt_input", "label" => __('Email Address', 'silencio'), "type" => "text", "sanitize_callback" => 'silencio_email'); $choices = array(' ' => '- select page -'); $pages = get_pages(array('sort_column' => 'post_title', 'hierarchical' => 0)); foreach ($pages as $page) { $choices[$page->ID] = $page->post_title; } $options[] = array("section" => "theme_options", "id" => SILENCIO_SHORTNAME . "_calendar_page_select_input", "label" => __('Calendar Page', 'viatheme_textdomain'), "type" => "select", "choices" => $choices); $options[] = array("section" => "theme_options", "id" => SILENCIO_SHORTNAME . "guide_url_txt_input", "label" => __('WordPress User Guide URL', 'silencio'), "type" => "text"); return $options; }
function wp_list_pages2($args) { $defaults = array('depth' => 0, 'show_date' => '', 'date_format' => get_option('date_format'), 'child_of' => 0, 'exclude' => '', 'title_li' => __('Pages'), 'echo' => 1, 'authors' => '', 'sort_column' => 'menu_order, post_title', 'link_before' => '', 'link_after' => ''); $r = wp_parse_args($args, $defaults); extract($r, EXTR_SKIP); $output = ''; $current_page = 0; // sanitize, mostly to keep spaces out $r['exclude'] = preg_replace('/[^0-9,]/', '', $r['exclude']); // Allow plugins to filter an array of excluded pages $r['exclude'] = implode(',', apply_filters('wp_list_pages_excludes', explode(',', $r['exclude']))); // Query pages. $r['hierarchical'] = 0; $pages = get_pages($r); if (!empty($pages)) { if ($r['title_li']) { $output .= '<li class="pagenav">' . $r['title_li'] . '<ul>'; } global $wp_query; if (is_page() || $wp_query->is_posts_page) { $current_page = $wp_query->get_queried_object_id(); } $output .= walk_page_tree($pages, $r['depth'], $current_page, $r); if ($r['title_li']) { $output .= '</ul></li>'; } } $output = apply_filters('wp_list_pages', $output); if ($r['echo']) { echo $output; } else { return $output; } }
function hp_landingpages_shortcode($atts, $content) { //get any attributes that may have been passed; override defaults $opts = shortcode_atts(array('id' => '', 'exclude' => '', 'type' => ''), $atts); // get child pages global $wp_query; $id = $opts['id'] == "" ? $wp_query->post->ID : $opts['id']; $children = get_pages("child_of=" . $id . "&parent=" . $id . "&hierarchical=0&exclude=" . $opts['exclude'] . "&posts_per_page=-1&post_type=page&sort_column=menu_order&sort_order=ASC"); foreach ((array) $children as $c) { if ($opts['type'] == 'list') { $output .= "<li><a href='" . get_permalink($c->ID) . "'>" . get_the_title($c->ID) . "</a></li>"; } else { $excerpt = ''; if ($c->post_excerpt) { $excerpt = $c->post_excerpt; } else { if (strlen($c->post_content) > 200) { $excerpt = substr(strip_tags($c->post_content), 0, 200) . "…"; } elseif ($c->post_content == "" || $c->post_content == 0) { $excerpt = ""; } else { $excerpt = strip_tags($c->post_content); } } $output .= "\n\t\t\t<div class='htlandingpage clearfix'>\n\t\t\t " . get_the_post_thumbnail($c->ID, "listingthumb", "class=listingthumb") . "\n\t\t\t <h2><a href='" . get_permalink($c->ID) . "'>" . get_the_title($c->ID) . "</a></h2>\n\t\t\t <p>" . $excerpt . "</p>\n\t\t\t</div>\n\t\t\t"; } } if ($opts['type'] == 'list') { $html = "<ul>" . $output . "</li>"; } else { $html = "<div class='htlandingpageblock'>" . $output . "</div>"; } return $html; }
public function testGetPages() { $params = array('title' => 'My test page is here', 'content_type' => 'page', 'is_active' => 1); //saving $new_page_id = save_content($params); $get_pages = get_pages($params); $page_found = false; if (is_array($get_pages)) { foreach ($get_pages as $page) { if ($page['id'] == $new_page_id) { $page_found = true; $this->assertEquals('page', $page['content_type']); } //PHPUnit $this->assertEquals(true, intval($page['id']) > 0); } } //clean $delete_sub_page = delete_content($new_page_id); //PHPUnit $this->assertEquals(true, $page_found); $this->assertEquals(true, intval($new_page_id) > 0); $this->assertEquals(true, is_array($get_pages)); $this->assertEquals(true, is_array($delete_sub_page)); }
function wptouch_migrate_modded_menu() { $menu_name = 'WPtouch - Recovered Page Menu'; $menu_object = wp_get_nav_menu_object($menu_name); if (!$menu_object) { $menu_id = wp_create_nav_menu($menu_name); $pages = get_pages(array('post_status' => 'publish', 'sort_column' => 'menu_order, post_title')); $menu_items = array(); $skipped_pages = array(); foreach ($pages as $page) { if (wptouch_menu_is_disabled($page->ID)) { $skipped_pages[] = $page->ID; } elseif (!in_array($page->post_parent, $skipped_pages)) { $parent_id = 0; if (isset($menu_items[$page->post_parent])) { $parent_id = $menu_items[$page->post_parent]; } $args = array('menu-item-db-id' => 0, 'menu-item-object-id' => $page->ID, 'menu-item-object' => 'page', 'menu-item-type' => 'post_type', 'menu-item-parent-id' => $parent_id, 'menu-item-status' => 'publish'); $menu_items[$page->ID] = wp_update_nav_menu_item($menu_id, 0, $args); $menu_icon = get_post_meta($page->ID, '_wptouch_pro_menu_item_icon', true); if ($menu_icon) { add_post_meta($menu_items[$page->ID], '_wptouch_pro_menu_item_icon', $menu_icon); } } } } else { $menu_id = $menu_object->ID; } return $menu_id; }
function ninja_forms_register_form_settings_basic_metabox() { if (isset($_REQUEST['form_id'])) { $form_id = absint($_REQUEST['form_id']); $form_data = Ninja_Forms()->form($form_id)->get_all_settings(); } else { $form_id = ''; $form_row = ''; $form_data = ''; } $pages = get_pages(); $pages_array = array(); $append_array = array(); array_push($pages_array, array('name' => __('- None', 'ninja-forms'), 'value' => '')); array_push($append_array, array('name' => __('- None', 'ninja-forms'), 'value' => '')); foreach ($pages as $pagg) { array_push($pages_array, array('name' => $pagg->post_title, 'value' => get_page_link($pagg->ID))); array_push($append_array, array('name' => $pagg->post_title, 'value' => $pagg->ID)); } if (isset($form_data['ajax'])) { $ajax = $form_data['ajax']; } else { $ajax = 0; } $args = apply_filters('ninja_forms_form_settings_basic', array('page' => 'ninja-forms', 'tab' => 'form_settings', 'slug' => 'basic_settings', 'title' => __('Display', 'ninja-forms'), 'state' => 'closed', 'settings' => array(array('name' => 'form_title', 'type' => 'text', 'label' => __('Form Title', 'ninja-forms')), array('name' => 'show_title', 'type' => 'checkbox', 'label' => __('Display Form Title', 'ninja-forms')), array('name' => 'append_page', 'type' => 'select', 'desc' => '', 'label' => __('Add form to this page', 'ninja-forms'), 'display_function' => '', 'help' => '', 'options' => $append_array), array('name' => 'ajax', 'type' => 'checkbox', 'desc' => '', 'label' => __('Submit via AJAX (without page reload)?', 'ninja-forms'), 'display_function' => '', 'help' => ''), array('name' => 'clear_complete', 'type' => 'checkbox', 'desc' => '', 'label' => __('Clear successfully completed form?', 'ninja-forms'), 'display_function' => '', 'desc' => __('If this box is checked, Ninja Forms will clear the form values after it has been successfully submitted.', 'ninja-forms'), 'default_value' => 1), array('name' => 'hide_complete', 'type' => 'checkbox', 'desc' => '', 'label' => __('Hide successfully completed form?', 'ninja-forms'), 'display_function' => '', 'desc' => __('If this box is checked, Ninja Forms will hide the form after it has been successfully submitted.', 'ninja-forms'), 'default_value' => 1)))); ninja_forms_register_tab_metabox($args); $args = apply_filters('ninja_forms_form_settings_restrictions', array('page' => 'ninja-forms', 'tab' => 'form_settings', 'slug' => 'restrictions', 'title' => __('Restrictions', 'ninja-forms'), 'state' => 'closed', 'settings' => array(array('name' => 'logged_in', 'type' => 'checkbox', 'desc' => '', 'label' => __('Require user to be logged in to view form?', 'ninja-forms'), 'display_function' => '', 'help' => ''), array('name' => 'not_logged_in_msg', 'type' => 'rte', 'label' => __('Not Logged-In Message', 'ninja-forms'), 'desc' => __('Message shown to users if the "logged in" checkbox above is checked and they are not logged-in.', 'ninja-forms'), 'tr_class' => ''), array('name' => 'sub_limit_number', 'type' => 'number', 'desc' => '', 'label' => __('Limit Submissions', 'ninja-forms'), 'display_function' => '', 'desc' => __('Select the number of submissions that this form will accept. Leave empty for no limit.', 'ninja-forms'), 'default_value' => '', 'tr_class' => '', 'min' => 0), array('name' => 'sub_limit_msg', 'type' => 'rte', 'label' => __('Limit Reached Message', 'ninja-forms'), 'desc' => __('Please enter a message that you want displayed when this form has reached its submission limit and will not accept new submissions.', 'ninja-forms'), 'tr_class' => '')))); ninja_forms_register_tab_metabox($args); }
/** * Defines an array of options that will be used to generate the settings page and be saved in the database. * When creating the "id" fields, make sure to use all lowercase and no spaces. * */ function optionsframework_options() { $themename = 'wp_get_theme' ? wp_get_theme() : wp_get_theme(); $themename = $themename['Name']; $shortname = "of"; //Stylesheet Reader $alt_stylesheets = array("black" => "black", "brown" => "brown", "blue" => "blue", "green" => "green", "pink" => "pink", "purple" => "purple", "red" => "red", "yellow" => "yellow"); // Test data $test_array = array("one" => "One", "two" => "Two", "three" => "Three", "four" => "Four", "five" => "Five"); // Multicheck Array $multicheck_array = array("one" => "French Toast", "two" => "Pancake", "three" => "Omelette", "four" => "Crepe", "five" => "Waffle"); // Multicheck Defaults $multicheck_defaults = array("one" => "1", "five" => "1"); // Background Defaults $background_defaults = array('color' => '', 'image' => '', 'repeat' => 'repeat', 'position' => 'top center', 'attachment' => 'scroll'); // Pull all the categories into an array $options_categories = array(); $options_categories_obj = get_categories(); foreach ($options_categories_obj as $category) { $options_categories[$category->cat_ID] = $category->cat_name; } // Pull all the pages into an array $options_pages = array(); $options_pages_obj = get_pages('sort_column=post_parent,menu_order'); $options_pages[''] = 'Select a page:'; foreach ($options_pages_obj as $page) { $options_pages[$page->ID] = $page->post_title; } // If using image radio buttons, define a directory path $imagepath = get_stylesheet_directory_uri() . '/images/'; $options = array(array("name" => __("General Settings", "wrockmetro"), "type" => "heading"), array("name" => __("Custom Favicon URL", "wrockmetro"), "desc" => "Specify a 16px x 16px image that will represent your website's favicon.", "id" => "wrockmetro_favicon", "type" => "upload"), array("name" => __("Latest Posts", "wrockmetro"), "desc" => "Show 5 Latest Posts with Thumbnail in Sidebar.", "id" => "wrockmetro_activate_ltposts", "std" => "1", "type" => "checkbox"), array("name" => __("Show Author Profile", "wrockmetro"), "desc" => "Check the box to show Author Profile Below the Post.", "id" => "wrockmetro_author", "std" => "", "type" => "checkbox"), array("name" => __("Ads Management", "wrockmetro"), "type" => "heading"), array("name" => "Activate Ads Space Below Navigation", "desc" => "Activate Ads Space Below Navigation and put code in below test field.", "id" => "wrockmetro_banner", "std" => "", "type" => "checkbox"), array("name" => __("Ads code Below Main Navigation.", "wrockmetro"), "desc" => "Enter your ads code here, preferably a 728*15 link list unit, or a 728*90 lead-board ad.", "id" => "wrockmetro_banner_top", "std" => "", "type" => "textarea"), array("name" => __("AD Code For Single Post", "wrockmetro"), "desc" => "Path of the image to be displayed in sidebar section.", "id" => "wrockmetro_ad2", "std" => "", "type" => "textarea"), array("name" => __("AD Code For Footer", "wrockmetro"), "desc" => "Paste Ad Code for Footer Area below navigation.", "id" => "wrockmetro_ad1", "std" => "", "type" => "textarea"), $options[] = array("name" => __("Custom CSS", "wrockmetro"), "type" => "heading"), array("name" => __("Custom CSS", "wrockmetro"), "desc" => "Quickly add some CSS to your theme by adding it to this block.", "id" => "wrockmetro_customcss", "std" => "", "type" => "textarea"), array("name" => __("Social Media", "wrockmetro"), "type" => "heading"), array("name" => __("Show Social Follow ICONs", "wrockmetro"), "desc" => "Check the box to show social sites Follows buttons in Sidebar.", "id" => "wrockmetro_sharebut", "std" => "", "type" => "checkbox"), array("name" => __("Facebook URL", "wrockmetro"), "desc" => "Enter your Facebook URL if you have one", "id" => "wrockmetro_fb", "std" => "", "type" => "text"), array("name" => __("Twitter URL", "wrockmetro"), "desc" => "Enter your Twitter URL if you have one", "id" => "wrockmetro_tw", "std" => "", "type" => "text"), array("name" => __("RSS Feed URL", "wrockmetro"), "desc" => "Enter your RSS Feed URL if you have one", "id" => "wrockmetro_rss", "std" => "", "type" => "text"), array("name" => __("Google+ URL", "wrockmetro"), "desc" => "Enter your Google+ Link if you have one", "id" => "wrockmetro_gp", "std" => "", "type" => "text"), array("name" => __("Linked In URL", "wrockmetro"), "desc" => "Enter your Linkedin URL if you have one", "id" => "wrockmetro_in", "std" => "", "type" => "text"), array("name" => __("YouTube In URL", "wrockmetro"), "desc" => "Enter your YouTube URL if you have one", "id" => "wrockmetro_youtube", "std" => "", "type" => "text"), array("name" => __("Pinterest In URL", "wrockmetro"), "desc" => "Enter your Pinterest URL if you have one", "id" => "wrockmetro_pinterest", "std" => "", "type" => "text"), array("name" => __("Stumbleupon In URL", "wrockmetro"), "desc" => "Enter your Stumbleupon URL if you have one", "id" => "wrockmetro_stumbleupon", "std" => "", "type" => "text"), array("name" => __("Instagram In URL", "wrockmetro"), "desc" => "Enter your Instagram URL if you have one", "id" => "wrockmetro_instagram", "std" => "", "type" => "text"), array("name" => __("email In URL", "wrockmetro"), "desc" => "Enter your email URL if you have one", "id" => "wrockmetro_email", "std" => "", "type" => "text")); update_option('of_themename', $themename); return $options; }
/** * Defines an array of options that will be used to generate the settings page and be saved in the database. * When creating the "id" fields, make sure to use all lowercase and no spaces. * */ function optionsframework_options() { $themename = function_exists('wp_get_theme') ? wp_get_theme() : get_current_theme(); $themename = $themename['Name']; $shortname = "of"; //Stylesheet Reader $alt_stylesheets = array("black" => "black", "brown" => "brown", "blue" => "blue", "green" => "green", "pink" => "pink", "purple" => "purple", "red" => "red", "yellow" => "yellow"); // Test data $test_array = array("one" => "One", "two" => "Two", "three" => "Three", "four" => "Four", "five" => "Five"); // Multicheck Array $multicheck_array = array("one" => "French Toast", "two" => "Pancake", "three" => "Omelette", "four" => "Crepe", "five" => "Waffle"); // Multicheck Defaults $multicheck_defaults = array("one" => "1", "five" => "1"); // Background Defaults $background_defaults = array('color' => '', 'image' => '', 'repeat' => 'repeat', 'position' => 'top center', 'attachment' => 'scroll'); // Pull all the categories into an array $options_categories = array(); $options_categories_obj = get_categories(); foreach ($options_categories_obj as $category) { $options_categories[$category->cat_ID] = $category->cat_name; } // Pull all the pages into an array $options_pages = array(); $options_pages_obj = get_pages('sort_column=post_parent,menu_order'); $options_pages[''] = 'Select a page:'; foreach ($options_pages_obj as $page) { $options_pages[$page->ID] = $page->post_title; } // If using image radio buttons, define a directory path $imagepath = get_stylesheet_directory_uri() . '/images/'; $options = array(array("name" => "General Settings", "type" => "heading"), array("name" => "Custom Logo", "desc" => "Choose your own logo. Optimal Size: 215px Wide by 55px Height", "id" => "colorway_logo", "type" => "upload"), array("name" => "Custom Favicon", "desc" => "Specify a 16px x 16px image that will represent your website's favicon.", "id" => "colorway_favicon", "type" => "upload"), array("name" => "Tracking Code", "desc" => "Paste your Google Analytics (or other) tracking code here.", "id" => "colorway_analytics", "std" => "", "type" => "textarea"), array("name" => "Body Background Image", "desc" => "Select image to change your website background", "id" => "inkthemes_bodybg", "std" => "", "type" => "upload"), array("name" => "Home Top Feature", "type" => "heading"), array("name" => "Home Top Feature Image", "desc" => "Choose Image for your Home Top Feature. Optimal Size: 900px x 350px", "id" => "colorway_slideimage1", "type" => "upload"), array("name" => "Home Top Feature Heading", "desc" => "Enter the Heading for Home Top Feature", "id" => "colorway_slideheading1", "std" => "", "type" => "text"), array("name" => "Home Top Feature Heading Link", "desc" => "Enter the Link URL in Heading for Home Top Feature", "id" => "colorway_slidelink1", "std" => "", "type" => "text"), array("name" => "Home Top Feature Description", "desc" => "Description for Home Top Feature", "id" => "colorway_slidedescription1", "std" => "", "type" => "textarea"), array("name" => "Home Page Settings", "type" => "heading"), array("name" => "Home Page Intro", "desc" => "Enter your heading text for home page", "id" => "inkthemes_mainheading", "std" => "", "type" => "text"), array("name" => "First Feature Image", "desc" => "Choose image for your feature column first. Optimal size 198px x 115px", "id" => "inkthemes_fimg1", "std" => "", "type" => "upload"), array("name" => "First Feature Heading", "desc" => "Enter your heading line for first column", "id" => "inkthemes_headline1", "std" => "", "type" => "text"), array("name" => "First Feature Link", "desc" => "Enter your link for feature column first", "id" => "inkthemes_link1", "std" => "", "type" => "text"), array("name" => "First Feature Content", "desc" => "Enter your feature content for column first", "id" => "inkthemes_feature1", "std" => "", "type" => "textarea"), array("name" => "Second Feature Image", "desc" => "Choose image for your feature column second. Optimal size 198px x 115px", "id" => "inkthemes_fimg2", "std" => "", "type" => "upload"), array("name" => "Second Feature Heading", "desc" => "Enter your heading line for second column", "id" => "inkthemes_headline2", "std" => "", "type" => "text"), array("name" => "Second Feature Link", "desc" => "Enter your link for feature column second", "id" => "inkthemes_link2", "std" => "", "type" => "text"), array("name" => "Second Feature Content", "desc" => "Enter your feature content for column second", "id" => "inkthemes_feature2", "std" => "", "type" => "textarea"), array("name" => "Third Feature Image", "desc" => "Choose image for your feature column thrid. Optimal size 198px x 115px", "id" => "inkthemes_fimg3", "std" => "", "type" => "upload"), array("name" => "Third Feature Heading", "desc" => "Enter your heading line for third column", "id" => "inkthemes_headline3", "std" => "", "type" => "text"), array("name" => "Third Feature Link", "desc" => "Enter your link for feature column third", "id" => "inkthemes_link3", "std" => "", "type" => "text"), array("name" => "Third Feature Content", "desc" => "Enter your feature content for third column", "id" => "inkthemes_feature3", "std" => "", "type" => "textarea"), array("name" => "Fourth Feature Image", "desc" => "Choose image for your feature column fourth. Optimal size 198px x 115px", "id" => "inkthemes_fimg4", "std" => "", "type" => "upload"), array("name" => "Fourth Feature Heading", "desc" => "Enter your heading line for fourth column", "id" => "inkthemes_headline4", "std" => "", "type" => "text"), array("name" => "Fourth Feature link", "desc" => "Enter your link for feature column fourth", "id" => "inkthemes_link4", "std" => "", "type" => "text"), array("name" => "Fourth Feature Content", "desc" => "Enter your feature content for fourth column", "id" => "inkthemes_feature4", "std" => "", "type" => "textarea"), array("name" => "Home Page Testimonial", "desc" => "Enter your text for homepage testimonial in short paragraph.", "id" => "inkthemes_testimonial", "std" => "", "type" => "textarea"), $options[] = array("name" => "Styling Options", "type" => "heading"), array("name" => "Custom CSS", "desc" => "Quickly add some CSS to your theme by adding it to this block.", "id" => "inkthemes_customcss", "std" => "", "type" => "textarea"), array("name" => "Footer Settings", "type" => "heading"), array("name" => "Facebook URL", "desc" => "Enter your Facebook URL if you have one", "id" => "colorway_facebook", "std" => "", "type" => "text"), array("name" => "Twitter URL", "desc" => "Enter your Twitter URL if you have one", "id" => "colorway_twitter", "std" => "", "type" => "text"), array("name" => "RSS Feed URL", "desc" => "Enter your RSS Feed URL if you have one", "id" => "colorway_rss", "std" => "", "type" => "text"), array("name" => "Linked In URL", "desc" => "Enter your Linkedin URL if you have one", "id" => "colorway_linkedin", "std" => "", "type" => "text"), array("name" => "Stumble Upon URL", "desc" => "Enter your Stumble Upon URL if you have one", "id" => "colorway_stumble", "std" => "", "type" => "text"), array("name" => "Digg URL", "desc" => "Enter your Stumble Upon URL if you have one", "id" => "colorway_digg", "std" => "", "type" => "text")); update_option('of_themename', $themename); return $options; }
/** * Outputs the HTML for this widget. * * @param array, An array of standard parameters for widgets in this theme * @param array, An array of settings for this widget instance * @return void Echoes it's output **/ function widget($args, $instance) { extract($args, EXTR_SKIP); $page = (int) $instance['page']; if (empty($page)) { return; } // Build a menu listing top level parent's children $args = array('child_of' => $page, 'parent' => $page, 'sort_column' => 'menu_order', 'post_type' => 'page'); $depth = 1; $subpages = get_pages(apply_filters('be_static_subpages_widget_args', $args, $depth)); // If there are pages, display the widget if (empty($subpages)) { return; } echo $before_widget; // Build title $title = esc_attr($instance['title']); if (1 == $instance['title_from_parent']) { $title = get_the_title($page); } $title = apply_filters('be_static_subpages_widget_title', $title); if (1 == $instance['title_link']) { $title = '<a href="' . get_permalink($page) . '">' . $title . '</a>'; } if (!empty($title)) { echo $before_title . $title . $after_title; } // Print the tree $active = is_singular() && !$instance['active'] ? get_the_ID() : $instance['active']; $this->build_subpages($subpages, $page, $active); echo $after_widget; }