Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6018155
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T03:14:03+00:00 2026-05-23T03:14:03+00:00

Long story short, I’m using a buggy WordPress template and we’re too far into

  • 0

Long story short, I’m using a buggy WordPress template and we’re too far into development to change. Good news is that we only have one item left to deal with and the rest I’ve been able to hack away at with my beginner PHP skills and a little help from a friend.

The homepage of the template grabs all posts and creates a thumbnail. What I want to do is have those links go to the corresponding page.

I just need to add some code any posts page that change the URL after WP’s output

<li><a href='localhost/brian/vhs_or_beta' title='VHS or Beta'>VHS or Beta</a></li>
<li><a href='localhost/brian/the_ettes' title='The Ettes'>The Ettes</a></li>

becomes

<li><a href='localhost/brian/vhs-or-beta' title='VHS or Beta'>VHS or Beta</a></li>
<li><a href='localhost/brian/the-ettes' title='The Ettes'>The Ettes</a></li>

by changing “_” to “-“

Just to be clear, I still want the page to draw using the latest posts but I want them to link to their corresponding page. I know it’s repetitive but for the sake of clarity I’ve used the same names but I’ve used “_” to indicate post, and “-” to indicate page.

I figured today would also be a good day to learn PHP regex but there are only 4 links and it’s not changing any time soon.

My question is whether it’s a better idea to do this with a separate PHP script rather than try to hack WP….either way I’m out of my depth but I at least want to start trying in the right place.

I’m thinking that the easiest way would be a small PHP script that would simple search 4 explicit URLs appearing in <a href> and changing them for 4 specific alternatives.

Can anyone give me some guidance here?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T03:14:04+00:00Added an answer on May 23, 2026 at 3:14 am

    You can try something like

    <li><a href='<? echo preg_replace('/_/','-',$url); ?>' title='<? echo $title; ?>'><? echo $title; ?></a></li>
    

    For more info see PHP preg_replace function

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Long story short, I need to sort an array of objects using usort, and
Long story short: I have 2 collections of objects. One contains good values (Let's
Long story short, I essentially created a branch of development within our trunk. About
Long story short, I have a substantial Python application that, among other things, does
To make a long story short I have to use processing in a class
Long story short: We've got a system that we're moving from one server to
Long story short: I've been layout out UI's with Html/CSS for about 8 years
Long story short, I'm taking a bunch of excel documents one by one, and
Long story short, I have two regex patterns. One pattern matches things that I
Long story short, I need to get up to speed with Joomla fast .

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.