SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Guru
    Join Date
    Oct 2010
    Location
    Portland, Or
    Posts
    724
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    defining a function in wp

    Hello all.
    I am working on a wp theme. first time really, rather than to start from absolute nothing (that'd be the next try)...
    Grabbed a very simple super minimalist template (thanks to zenhabits.org). And for example, wanted to add a sidebar to it.
    so in the index.php I added.
    the get_sidebar(); function
    I do have a sidebar.php in the correct directory.

    but get this error msg.
    "Fatal error: Call to undefined function responsive_widgets() in C:\xampp\htdocs\wordpress\wp-content\themes\zh2\sidebar.php on line 5"

    where do I add/specify functions? is the wp-includes>functions.php the best place?
    thx
    D

  2. #2
    SitePoint Addict deadmix's Avatar
    Join Date
    Jun 2009
    Location
    france
    Posts
    210
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    you have to add it on functions.php

    but my question do you have already a sidebar on this theme and you want to add another Extra one !?

  3. #3
    SitePoint Guru
    Join Date
    Oct 2010
    Location
    Portland, Or
    Posts
    724
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Hi deadmix, thanks for the pointer!
    actually there wasn't i was trying to add it. But about after 1/2 an hour gave up that theme & template and startead from even nearer scratch using a series of tutorials on youtube.
    much better. Got the sidebar.
    would like eventually to find out how to add more than two columns, rigth now just have the main body & the sidebar. that can be the next project & am open to advice.
    is there a diff tag for that?
    thx
    D

  4. #4
    SitePoint Addict deadmix's Avatar
    Join Date
    Jun 2009
    Location
    france
    Posts
    210
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by pdxSherpa View Post
    Hi deadmix, thanks for the pointer!
    actually there wasn't i was trying to add it. But about after 1/2 an hour gave up that theme & template and startead from even nearer scratch using a series of tutorials on youtube.
    much better. Got the sidebar.
    would like eventually to find out how to add more than two columns, rigth now just have the main body & the sidebar. that can be the next project & am open to advice.
    is there a diff tag for that?
    thx
    D
    You can add another sidebar by creating a new sidebar2.php file and add it to the theme, find the <?php include("sidebar.php"); ?> and just under it add : <?php include("sidebar2.php"); ?>

    Find :

    if ( function_exists('register_sidebar') )

    register_sidebar(2);
    We are adding another sidebar so change the (2) to a (3)...

    That's all

    Goodluck

  5. #5
    SitePoint Guru
    Join Date
    Oct 2010
    Location
    Portland, Or
    Posts
    724
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    thank you will go try it out today!


Bookmarks

Posting Permissions

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