Jump to content

Search the Community

Showing results for tags 'custom section'.

More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Found 2 results

  1. I have created a custom section, which uses wp_query to pull out posts of a particular category only. The section is intended to be used on custom page templates. I have created an option for this, so that the user can choose the category of posts that should be displayed. The option is a simple dropdown containing the list of categories. When I select a category from site wide options, it all works fine - only the posts in the chosen category are displayed. But when I select a category from the page options, it isn't applied. Here is my code: Setting up the option in my section .php file: function section_optionator( $settings ){ $settings = wp_parse_args( $settings, $this->optionator_default ); $array = array(); $categories = get_categories( $args ); $cat_arr = array(); foreach ($categories as $category) { $cat_arr[$category->category_nicename] = array('name' => $category->cat_name); } $array['aamhc_post_loop_categories'] = array( 'type' => 'select', 'selectvalues' => $cat_arr, 'inputlabel' => __( 'Select Category:', 'pagelines' ), 'title' => __( 'Choose a category. Posts from this category will be displayed', 'pagelines' ), 'shortexp' => __( 'Choose a cetgory of posts to display', 'pagelines' ), 'exp' => __( "", 'pagelines' ), ); $metatab_settings = array( 'id' => 'AAMHCPostLoopCat', 'name' => __( 'AAHMC Posts Loop (Category)', 'pagelines' ), 'icon' => $this->icon, 'clone_id' => $settings['clone_id'], 'active' => $settings['active'] ); register_metatab( $metatab_settings, $array ); } Pulling out the option: $cat_posts = new WP_Query(); $cat_posts->query('showposts=5&category_name=' . ploption('aamhc_post_loop_categories', $this->oset)); I had a look at the developer docs but the options section doesn't seem to be populated. Any help on how I can apply the option when selected from the page would be much appreciated. Many Thanks, John
  2. Hi there, I just create custom section and I need it to have background option selector (select image, background repeat, background potition). I copy the code from pageline code 'page_background_image' => array( 'title' => __( 'Site Background Image (Optional)', 'pagelines' ), 'shortexp' => __( 'Setup a background image for the background of your site', 'pagelines' ), 'exp' => __( 'Use this option to apply a background image to your site. This option will be applied to different areas depending on the design mode you have set.<br/><br/><strong>Positioning</strong> Use percentages to position the images, 0% corresponds to the <strong>top</strong> or <strong>left</strong> side, 50% to center, etc..', 'pagelines' ), 'type' => 'background_image', 'selectors' => cssgroup('page_background_image') ), and chage parameter name. The selector show up, but it CANNOT save, It's back to default state after save. Do you have any suggestion? or some example of section that have background option selector. Thanks