adsense

How to List Tags Without Links in WordPress





1. Log into the WordPress dashboard and navigate to 'Appearance.' Click the 'Editor' link under 'Appearance' to load the 'Edit Themes' screen. Locate the template file you want to edit under the 'Templates' heading.
2. Find the spot on the page where you want to display tags without links. If you want to replace the tags listed on the blog index, for example, edit 'index.php' and place your new code where '
' already exists.

3. Assign the value of 'get_the_tags()' to a new variable. Check to see if any tags exist using an 'if-then' statement.

Code goes in here.

4. Create a 'foreach' loop to loop through every value in the array that 'get_the_tags()' returns. The 'foreach' loop will look like this:
Code goes in here.
You must place the 'foreach' loop within the 'if-then' statement.
5. Output the name of each tag within the 'foreach' loop. Here is the code:
name; ?>This line of code finds the 'name' field for that tag's entry in the database and then outputs it to the screen.
6. Format the tag text however you like. For example, you can place a line break after each tag like this:
name . '
'; ?>The dot breaks from PHP code to something else -- in this case, a string between quotation marks. You can put HTML code or regular text between the quotation marks. The browser will execute the HTML as code instead of text.
7. Click the blue 'Save' button to save your changes to the template.

Comments

0 Responses to "How to List Tags Without Links in WordPress"

Post a Comment

Popular Posts

About