How can I modify specific attribute in CSS

2019-08-13 04:19发布

问题:

I am using WordPress. The following piece of code resides in loo-services.php

            if($ct_options['ct_book_now'] == 'Yes') {
                echo '<p>';
                    echo '<a class="book-now btn" href="#" data-service="';
                        the_title();
                    echo '">' . __('Book Now', 'contempo') . '</a>';
                echo '</p>';
            }

This piece of code generates through data-service="the_title()" method.

There is a button on the website "Book Now" When this button clicked then its forwarding to the default page.

I want when "Book Now" button clicked then forward user to another page rather then its default page that is used from data-service="the_title()".

On homepage there is a link of default service e.g. "Clinical Consultation". When this is clicked then link auto directs to its default page whereas I want to link this to custom page that I build in page builder e.g. This link www.website.com/index.php/clinical-consultation-2 instead of its default page link?

回答1:

You can use a redirection plugin: Redirection and that would serve the need:

  1. Download redirection.zip
  2. Unzip
  3. Upload redirection directory to your /wp-content/plugins directory
  4. Go to the plugin management page and enable the plugin
  5. Configure the options from the Manage/Redirection page


回答2:

With the incomplete information you provide in your question I would try something like this:

        if($ct_options['ct_book_now'] == 'Yes') {
            echo '<p>';
                echo '<a href="'.get_permalink().'">'.get_the_title().'</a>';
            echo '</p>';
        }