Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter lloicles

    (@lloicles)

    I’m not really great with code, but I’m also willing to have only one set category if a few selected isn’t possible. I take it the following code needs to be adjusted, but wouldn’t know how to approsch this. Any help would be appreciated.

    if($this->options['ttgps_chk_categoryfield'] == "on"){
    					$args = array(
    						'orderby' => 'name',
    						'order' => 'ASC'
    						);
    					$categories = get_categories($args);
    					$template_str .= '<select name="catdrp" class="postform" id="catdrp" ';
    					$template_str .= ($this->options['ttgps_chk_categoryfield_req']=="on") ? ' required="required" ' : ' ';
    					$template_str .= '> <option value="">Select a Category</option>';
    					foreach($categories as $category) {
    					    $template_str .= '<option value="' . $category->cat_ID . '">'.$category->name.'</option>';
    					}
    Plugin Author Rashed Latif

    (@rashedlatif)

    You have figured out the right part of the code.

    check the following link
    https://codex.www.ads-software.com/Function_Reference/get_categories

    Read through it. You will figure out what to change in the $args array to get the desired result.

    And i will create an option to select categories to be displayed. Keep an eye on the next updates.

    Doug M

    (@nes-native-english-services)

    I don’t want to give them a choice but I’d like to send them to a specific category.

    @lloicles – Did you get this dialed in?

    Doug M

    (@nes-native-english-services)

    @rashed – How would you stop the edit from being over written in an update? You eluded to the idea of putting the option in an update…Any ideas on when that might be?

    Also, I need to edit the background text on the submit form. Can you lead me in the write direction? Where would I find that text in the file structure.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘select certain categories?’ is closed to new replies.