Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 9 of 9
  1. #1
    New to the CF scene
    Join Date
    Jul 2010
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    how to insert accordion effect into page.php template

    Hi first time poster scratching his head.

    I am dipping into php to create a user profilepage.php template on a wordpress site.

    I have managed against all odds to create a user profile that will take info from
    Code:
     ?php the_author_meta('occupation'); ?
    etc, but my head is spinning trying to create an accordion for

    a photogallery
    Code:
    ?php echo do_shortcode("[photosmash]"); ?
    and youtube playlist
    Code:
    ?php (the_author_meta('youtube_playlist')); ?
    so I want to click on an image "MY VIDEOS" and the youtube playlist drops down, ditto with MY PHOTOS, click on the image and the gallery appears.

    The page with all the required content showing is http://traditionalpainter.com/andy-crichton

    I would really appreciate it if someone can point me in the right direction to code that will hide the gallery and video until required. Thanks in advance.

  • #2
    Senior Coder
    Join Date
    Jun 2008
    Location
    New Jersey
    Posts
    2,537
    Thanks
    45
    Thanked 259 Times in 256 Posts
    If you mean dynamic accordions, you're looking for Javascript, not PHP. There are a number of wordpress accordion plugins written with jQuery.

  • #3
    New to the CF scene
    Join Date
    Jul 2010
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Keleth View Post
    If you mean dynamic accordions, you're looking for Javascript, not PHP. There are a number of wordpress accordion plugins written with jQuery.
    Thanks. I have looked at a few javascripts but havent seen (or more likely understood!) an example of how to include them in a php template relevant to the two actions I want to achieve. I'll keep looking.

  • #4
    Senior Coder
    Join Date
    Jun 2008
    Location
    New Jersey
    Posts
    2,537
    Thanks
    45
    Thanked 259 Times in 256 Posts
    Well... with wordpress, there's no need to include them in a PHP template. I'll see if I can dig up the lists, but I know plugins exist for both actions you're trying to do (specially wordpress photogallery).

    Its either that or to write the code yoruself/use a standard jQuery accordion plugin. Note though, JS and PHP have nothing to do with each other.

  • #5
    New to the CF scene
    Join Date
    Jul 2010
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Keleth View Post
    Well... with wordpress, there's no need to include them in a PHP template. I'll see if I can dig up the lists, but I know plugins exist for both actions you're trying to do (specially wordpress photogallery).

    Its either that or to write the code yoruself/use a standard jQuery accordion plugin. Note though, JS and PHP have nothing to do with each other.
    Can you tell me the overview of what needs to be done to make it work ?

    Im getting the idea that this isnt just a case of wrapping a piece of php code in a div of some description? If feels so near but so far.

  • #6
    Senior Coder
    Join Date
    Jun 2008
    Location
    New Jersey
    Posts
    2,537
    Thanks
    45
    Thanked 259 Times in 256 Posts
    Well, this has nothing to do with PHP. Javascript is completely unrelated. If you can find the right jQuery plugin, it'll have plenty of examples of how it works... if you don't know Javascript at all, I recommend you learn the basics before delving into jQuery. If not, you can find plenty of guides on how to use jQuery and you can just google "jQuery Wordpress accordion plugin" for plugins.

  • #7
    New to the CF scene
    Join Date
    Jul 2010
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Keleth View Post
    Well, this has nothing to do with PHP. Javascript is completely unrelated. If you can find the right jQuery plugin, it'll have plenty of examples of how it works... if you don't know Javascript at all, I recommend you learn the basics before delving into jQuery. If not, you can find plenty of guides on how to use jQuery and you can just google "jQuery Wordpress accordion plugin" for plugins.
    thanks, google is our friend with the right question. I guess Im in a bigger loop than I thought. I will take a step back to look into js further. much appreciated.

  • #8
    New to the CF scene
    Join Date
    Jul 2010
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    hey Keleth, managed to work out how to implement a tabs jquery script with the usermeta. Just need to address a css issue with the photogallery, and I will be good to go - on to the next bit. cheers

  • #9
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    Ok, so definitely JS / client technology? I've been waiting to see where this goes to see if it was an integration thing with wordpress.
    Moving from PHP to Javascript.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 
    Been gone for a few months, and haven't programmed in that long of a time. Meh, I'll wing it ;)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •