Modify URL on Wordpress OceanWP Logo Banner

To modify the URL on the WordPress OceanWP logo banner, you can follow these steps:

Step 1: Create a Child Theme

Creating a child theme is essential to ensure that your customizations are not lost when the parent theme is updated. Here’s how to create a child theme:

  1. Create a New Folder: In your WordPress themes directory (wp-content/themes/), create a new folder for your child theme. Give it a unique name, like “oceanwp-child.”

  2. Create a style.css File: Inside the child theme folder, create a style.css file. Add the following header information to it:

1
2
3
4
5
6
7
/*
Theme Name: OceanWP Child
Description: Child theme for OceanWP
Author: Your Name
Template: oceanwp
Version: 1.0
*/
  1. Create a functions.php File: In the child theme folder, create a functions.php file. This file will be used to enqueue your custom CSS and make other modifications.

Step 2: Export Settings from the Parent OceanWP Theme

  1. In your WordPress dashboard, go to “Theme Panel” under “OceanWP.”

  2. Navigate to the “Import/Export” tab.

  3. Click on the “Export” button to save your parent theme’s settings to a JSON file.

Step 3: Import Settings to OceanWP Child Theme

  1. In your WordPress dashboard, go to “Appearance” > “Theme Panel” under your OceanWP Child Theme.

  2. Navigate to the “Import/Export” tab.

  3. Click on the “Choose File” button to upload the JSON file you exported in the previous step.

  4. Click on the “Import” button to import the settings into your child theme.

Step 4: Edit functions.php and Add Logo URL Modification Function

In your child theme’s functions.php file, you can add a function to modify the logo URL. Here’s an example function to change the logo URL:

1
2
3
4
5
6
7
function modify_logo_url($html) {
    $custom_url = 'https://your-custom-url.com'; // Replace with your desired URL
    $html = preg_replace('/href=["\']([^"\']+)["\']/i', 'href="' . $custom_url . '"', $html);
    return $html;
}

add_filter('ocean_logo_url', 'modify_logo_url');

Replace 'https://your-custom-url.com' with the URL you want the logo to link to. This function hooks into the ocean_logo_url filter provided by OceanWP and replaces the logo’s URL with your custom URL.

Make sure to save the changes to your functions.php file.

Activate the Child Theme

After creating the child theme and making the necessary modifications, you can activate the child theme from your WordPress dashboard. Your custom logo URL should now be active on your OceanWP website’s logo banner.

Remember to back up your website and test the changes in a staging environment before making them on a live site to avoid any potential issues.

0%