Where do I add code?
-
Hi, I am new to the forums and new to WordPress, after googling for many days I and not being able to find a satisfactory answer I ahve decided to post here. Basically my question is where do I put code in wordpress? I have been searching for answers to many questions I have and many times the answer that I find is: “use this code” and the code, but I have never seen an explanation of where to put that code and how. I have read and watched tutorials about wordpress but they don’t deal with this issue.
Example: I have been looking for a way to display all the subcategories of a certain category on a page. I found this answer: use this code…
$args = array('child_of' => 17); $categories = get_categories( $args ); foreach($categories as $category) { echo '<p>Category: <a href="' . get_category_link( $category->term_id ) . '" title="' . sprintf( __( "View all posts in %s" ), $category->name ) . '" ' . '>' . $category->name.'</a> </p> '; echo '<p> Description:'. $category->description . '</p>'; echo '<p> Post Count: '. $category->count . '</p>'; }Great!! But where do I place that code? I put it on the page and it didn’t work. I created a custom page template and put it there and it didn’t work; I added php tags at the beginning and the end and it didn’t work. Pretty frustrating. I know, I know, i am a newbie and I have to be patient but I need help.
Thanks.
The topic ‘Where do I add code?’ is closed to new replies.