Sainath Poojary
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: Добавить телефон в заголовок сайтаHey @marina2623,
To create a clickable phone number in WordPress, add a Custom Link in menu using:
URL: “tel:+79001234567”
Link Text: “+7 (900) 123-45-67” (Anything you want to display to the user.
That’s it! Your phone number will now be clickable.
Forum: Fixing WordPress
In reply to: Error establishing a database connectionHey @greenn,
The “Error establishing a database connection” is a common issue during WordPress installation. This typically occurs when the database credentials in the wp-config.php file are incorrect.
Here are some possible solutions:
Step 1: Verify that MySQL is up and running. If it’s not, try resolving that issue first.
Step 2: If MySQL is running correctly, check the wp-config.php file and ensure the database configuration constants are correctly set in following constants.
/** The name of the database for WordPress */
define( 'DB_NAME', 'local' );
/** Database username */
define( 'DB_USER', 'root' );
/** Database password */
define( 'DB_PASSWORD', 'root' );
/** Database hostname */
define( 'DB_HOST', 'localhost' );This should likely resolve your issue. Feel free to reach out if you encounter any other problems.
Forum: Fixing WordPress
In reply to: Advanced Custom FieldsHey @dad0,
To display all products with a specific value (like GENRE|JUNIOR) in the custom field meta_easyfatt_libero_1 on your site, you can create a custom template file and a new page using that template. Here’s how you can achieve this:1. Create a Child Theme (if you don’t already have one):Creating a child theme ensures that your customizations won’t be lost when the parent theme is updated.
- Step 1: Navigate to
wp-content/themes/using FTP or your hosting file manager. - Step 2: Create a new folder called
yourtheme-child(replace “yourtheme” with the name of your active theme). - Step 3: Inside the
yourtheme-childfolder, create two files:style.cssandfunctions.php(optional). - Step 4: In
style.css, add the following code:
/*
Theme Name: YourTheme Child
Template: yourtheme
*/- Step 6: Go to your WordPress admin dashboard, then go to
Appearance > Themes, and activate theYourTheme Childtheme.
2. Create a Custom Template File:
- Step 1: Inside your child theme folder (
yourtheme-child), create a new file calledtemplate-easyfatt-products.php. - Step 2: Open this file and add the following code:
<?php
/* Template Name: Easyfatt Products */
get_header(); ?>
<div class="easyfatt-products-list">
<h1>Products with GENRE | JUNIOR</h1>
<?php
// Query products with meta_easyfatt_libero_1 containing GENRE|JUNIOR
$args = array(
'post_type' => 'product',
'meta_query' => array(
array(
'key' => 'meta_easyfatt_libero_1',
'value' => 'GENRE|JUNIOR',
'compare' => 'LIKE',
),
),
);
$query = new WP_Query($args);
if ($query->have_posts()) {
while ($query->have_posts()) {
$query->the_post(); ?>
<div class="product">
<h2><?php the_title(); ?></h2>
<a href="<?php the_permalink(); ?>">View Product</a>
</div>
<?php }
} else {
echo '<p>No products found with GENRE | JUNIOR.</p>';
}
wp_reset_postdata();
?>
</div>
<?php get_footer(); ?>- Step 3: Save the file.
- Step 4: Create a functions.php file in your child theme folder if you don’t already have one and add the following code to enqueue styles for your custom template [optional: if you want to add custom styles]:
<?php
// Enqueue styles for your custom template
function enqueue_custom_styles() {
if (is_page_template('template-easyfatt-products.php')) {
wp_enqueue_style('custom-styles', get_stylesheet_directory_uri() . '/custom-styles.css');
}
}
add_action('wp_enqueue_scripts', 'enqueue_custom_styles');3. Create a New Page Using the Template:
- Step 1: Go to
Pages > Add Newin your WordPress dashboard. - Step 2: Title the page something like “Products by Genre”.
- Step 3: In the
Page Attributessection on the right-hand side, selectEasyfatt Productsfrom the Template dropdown. - Step 4: Publish the page.
4. View the Page:
- Step 1: After publishing the page, visit the URL (e.g.,
yoursite.com/products-by-genre/), and you should see all products that matchGENRE|JUNIORfrom the custom fieldmeta_easyfatt_libero_1.
This approach provides you with a linkable page that displays all products with the value
GENRE|JUNIORin the custom meta field. - Step 1: Navigate to