WordPress.org

Support

Support » Themes and Templates » best theming way

best theming way

  • cristopher_elsner
    Member

    @cristopher_elsner

    hi,

    I want different sidebar(right). For now I am using this way:

    <?php
    if($url_check==’contact’)
    {
    CONTACT FORM
    }
    else if($url_check==’about_us’)
    {
    TESTIMONIALS
    }
    ?>

    This way Conditions I am using are STATIC like contact,about_us.
    Now what If admin changes contact to contact-us.

    So, I want Dynamic Solution(condition).

    Please help me…

    Thanks
    Cristopher.

Viewing 3 replies - 1 through 3 (of 3 total)
  • mr49online
    Member

    @mr49online

    Hi, cristopher_elsner!!!
    Try this scenario, get the permalink and try to explode it, and pass its last array index which is your page name.

    Example:

    <?php
      $permalink = get_permalink( );
          $c = explode('/', $permalink);
    	echo "<pre>";
    	  print_r($c);
    	echo "</pre>";
    	$a = $c[4];
    	echo $a;
    ?>

    OutPut:

    http://localhost/wp-quickstart/testpage
    Array
    (
        [0] => http:
        [1] =>
        [2] => localhost
        [3] => wp-quickstart
        [4] => testpage
    )
    testpage

    cristopher_elsner
    Member

    @cristopher_elsner

    hi mr49online,

    Thank you for your help.

    mr49online
    Member

    @mr49online

    @cristopher_elsner: you welcome ………. :),
    hope you got the solution of your issue, isn’t it?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘best theming way’ is closed to new replies.