Viewing 3 replies - 1 through 3 (of 3 total)
  • look under Teams, then select to edit Bluebirds team, look to the right side for Details > Competitions and select the competitions (Group A B C) you want Bluebirds in.

    Thread Starter Gheorghiu Robert

    (@robertutzu)

    yes, thx

    Example for others:

    Add a Primary League and after that add sub parent to it like
    Group A, Group B

    here is my code to display on a template page all Group teams like
    Group A
    team name 1
    team name 2 etc.

    <?php
    /**
     * The template for displaying the Groupe Teams.
     *
     * Template Name: Grupe
     *
     * @package Rookie
     */
    
    get_header(); ?>
    
    	<div id="primary" class="content-area">
    		<main id="main" class="site-main" role="main">
    
    <?php
    	$table_name = $wpdb->prefix . "term_taxonomy";
    	$sql = "SELECT term_id FROM " . $table_name . " where parent!='0'";
    	$pageposts = $wpdb->get_results($sql);
    
    	foreach ( $pageposts as $pagepost)
    	{	
    
    			$table_name = $wpdb->prefix . "terms";
    			$sql = "SELECT name FROM " . $table_name . " where term_id='".$pagepost->term_id."'";
    			$ageposts = $wpdb->get_results($sql);
    			foreach ( $ageposts as $agepost)
    			{
    				echo '<h4 class="sp-table-caption">'.$agepost->name.'</h4>';
    			}
    
    			echo '<table class="sp-data-table">';
    			$table_name = $wpdb->prefix . "term_relationships";
    			$sql = "SELECT object_id FROM " . $table_name . " where term_taxonomy_id='".$pagepost->term_id."'";
    			$echipe = $wpdb->get_results($sql);
    			foreach ( $echipe as $echipa)
    			{
    
    				$table_name = $wpdb->prefix . "posts";
    				$sql = "SELECT post_title FROM " . $table_name . " where id='".$echipa->object_id."'";
    				$nechipe = $wpdb->get_results($sql);
    				foreach ( $nechipe as $nechipa)
    				{
    					echo '<tr><td>'.$nechipa->post_title.'</td></tr>';
    				}
    
    			}
    
    			echo '</table>';
    	}
    ?>
    
    		</main><!-- #main -->
    	</div><!-- #primary -->
    
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>

    Thread Starter Gheorghiu Robert

    (@robertutzu)

    Edit: replace with this code, this is good:

    <?php
    /**
     * The template for displaying the homepage.
     *
     * Template Name: Grupe
     *
     * @package Rookie
     */
    
    get_header(); ?>
    
    	<div id="primary" class="content-area">
    		<main id="main" class="site-main" role="main">
    
    <?php
    	$table_name = $wpdb->prefix . "term_taxonomy";
    	$sql = "SELECT term_id FROM " . $table_name . " where parent!='0'";
    	$pageposts = $wpdb->get_results($sql);
    
    	foreach ( $pageposts as $pagepost)
    	{	
    
    			$table_name = $wpdb->prefix . "terms";
    			$sql = "SELECT name FROM " . $table_name . " where term_id='".$pagepost->term_id."'";
    			$ageposts = $wpdb->get_results($sql);
    			foreach ( $ageposts as $agepost)
    			{
    				echo '<h4 class="sp-table-caption">'.$agepost->name.'</h4>';
    			}
    
    			echo '<table class="sp-data-table">';
    			$table_name = $wpdb->prefix . "term_relationships";
    			$sql = "SELECT object_id FROM " . $table_name . " where term_taxonomy_id='".$pagepost->term_id."'";
    			$echipe = $wpdb->get_results($sql);
    			foreach ( $echipe as $echipa)
    			{
    
    				$table_name = $wpdb->prefix . "posts";
    				$sql = "SELECT post_title, guid FROM " . $table_name . " where post_type='sp_team' AND id='".$echipa->object_id."'";
    				$nechipe = $wpdb->get_results($sql);
    				foreach ( $nechipe as $nechipa)
    				{
    					echo '<tr><td>'.$nechipa->post_title.'</td></tr>';
    					//echo '<tr><td><a>guid.'">'.$nechipa->post_title.'</a></td></tr>';
    				}
    
    			}
    
    			echo '</table>';
    	}
    ?>
    
    		</main><!-- #main -->
    	</div><!-- #primary -->
    
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to add team to a Group?’ is closed to new replies.