shawnyuan
Forum Replies Created
-
Forum: Themes and Templates
In reply to: link to category inside post?Yea you can use this:
<?php // Get the ID of a given category $category = get_the_category(); $category_id = $category[0]->cat_ID; $category_name = $category[0]->cat_name; // Get the URL of this category $category_link = get_category_link( $category_id ); ?> <!-- Print a link to this category --> <a href="<?php echo $category_link; ?>" title="Category Name"><?php echo $category_name; ?></a>
Forum: Themes and Templates
In reply to: Website url field in commentsGet your hands on a new comments.php template. They include url by default. Here’s part of my code for the url part:
<p>Logged in as <a href="<?php echo get_option('siteurl'); ?>/wp-admin/profile.php"><?php echo $user_identity; ?></a>. <a href="<?php echo wp_logout_url(get_permalink()); ?>" title="Log out of this account">Log out »</a></p> <?php else : ?> <div class="fields"> <?php $req = true; ?> <label for="author">Name <?php if ($req) echo "*"; ?></label> <input type="text" name="author" id="author" value="<?php echo $comment_author; ?>" size="22" tabindex="1" /> </div> <div class="fields"> <label for="email">Mail (will not be published) <?php if ($req) echo "*"; ?></label> <input type="text" name="email" id="email" value="<?php echo $comment_author_email; ?>" size="22" tabindex="2" /> </div> <div class="fields"> <label for="url">Website</label> <input type="text" name="url" id="url" value="<?php echo $comment_author_url; ?>" size="22" tabindex="3" /> </div> <?php endif; ?>
Forum: Themes and Templates
In reply to: [picture perfect theme] no "posted on" date for most recent postYou’ll probably need to add the author and date yourself, to the index.php page.
To add the author, use this: https://codex.www.ads-software.com/Function_Reference/the_author
To add the date, use this: https://codex.www.ads-software.com/Function_Reference/the_date
Paste the contents of your index.php file if you need to know where to place the code.
Forum: Fixing WordPress
In reply to: Using a buddypress xprofile field as a custom field in postUse the following code to grab the specific field you want.
<?php if ( 'interests' == bp_get_the_profile_field_name() ) : ?> <?php $interests = bp_get_the_profile_field_edit_value() ?>
To add custom meta value to the post, start here: https://codex.www.ads-software.com/Custom_Fields. This allows you to get the custom field saved with each post. But for the custom field to appear with each post (with the 10 checkboxes), you’ll have to add the meta field in manually.
Forum: Themes and Templates
In reply to: how can i apply different themes in each page?Good job.
Forum: Themes and Templates
In reply to: Next/Previous Post and Page link code not workingTry wp-pagenavi plugin. It’s better than the default next/prev link.
If you like the default next/prev link, dig into a default theme in wordpress which contains those.
Forum: Themes and Templates
In reply to: In header.php where is tag closed?Yep your probably right @thebiganswer. Sometimes the tag that’s not closed will be called #container, or #content.
Forum: Themes and Templates
In reply to: Changing Order of Page Titles in Header1st question: Try this: https://wpdude.com/changing-order-pages/
Basically you go into each page, there is a field called “Order” on the right hand side of a page, say About Me. Give it a number, say 5.
Your page is displayed in ascending order.
Forum: Themes and Templates
In reply to: Template files are ignoredDescribe the problem in more details.
Forum: Themes and Templates
In reply to: Longer spaces between paragraphsUse CSS,
#container p { margin-bottom:10px; }
Forum: Fixing WordPress
In reply to: Using a buddypress xprofile field as a custom field in postStart with this:
Go to your buddypress plugin directory and find this:
buddypress/bp-themes/bp-default/registration/register.php.
After, study the code below. It allows you to get details for the logged in user. The code below assumes that you have the following profile fields: First Name, Last Name, Location and Website.
[Code moderated]
The key is the line below, which allows you to match the profile field you are looking for
<?php elseif ( 'Website' == bp_get_the_profile_field_name() ) : ?>
bp_get_the_profile_field_edit_value allows you to display the field
Forum: Themes and Templates
In reply to: how can i apply different themes in each page?You want to create your own Page Template.
You can start here: https://codex.www.ads-software.com/Pages#Creating_Your_Own_Page_Templates
You need to:
1. Create a page template , call it template-about.php and add the following code to the top. Wrap the contents of this page with html tags, so that you can style it.
<?php /* Template Name: About Us */ ?>
2. Next create a page in the wordpress backend, under Template (right sidebar), select “About Us” as the template.
3. Style it however you want with css.