ivanisevic82
Forum Replies Created
-
Forum: Plugins
In reply to: [Yoast SEO] Coexistence of Custom Schema Markup and Yoast SchemasHello Maybellyne, thank you for the support. Regarding the last issue, I went through the documentation you linked, but I didn’t find specific instructions for removing the sitelink search box, only the breadcrumbs. Contrarily, I would like to keep the breadcrumbs but remove the text search box to use my custom one. Do you think a code like this would work?
Thank you again!
add_filter( ‘wpseo_schema_website’, ‘remove_searchaction_from_website_schema’ );
function remove_searchaction_from_website_schema( $data ) {
if (isset($data[‘potentialAction’])) {
unset($data[‘potentialAction’]);
}
return $data;
}Forum: Plugins
In reply to: [LiteSpeed Cache] Litespeed cache script and css web page test alertSorry for the triple post but in the meantime I found the options in Litespeed Cache and ran some tests. Enabling JS delay effectively makes those JS rendering blocks disappear. On the contrary, activating the “Load CSS Asynchronously” option does not change anything. In any case, I would like to avoid activating these options because they would affect ALL my scripts and CSS, while I would like to act selectively on those mentioned at the beginning. The problem, however, is that if I manually operate in functions.php as I usually do to assign defer or delay, I get no results. Perhaps this is because the scripts and css in question are dynamically generated by litespeed Cache. Should I ignore them?
Forum: Plugins
In reply to: [LiteSpeed Cache] Litespeed cache script and css web page test alertI add that I controlled the source code and there no trace of jss and css mentioned before.
Forum: Plugins
In reply to: [LiteSpeed Cache] Litespeed cache script and css web page test alertThank you for support, but I still need some help.
When you write “enable JS delay” do you think about a option of the plugin Litespeed Cache or adding manually the code in functions.php ?
And why delay and not defer or async?
Thank you again!
Dear,
first of all thank you for the feedback.I finally got the plugin to work with my html/css contact form.
In fact, to have greater flexibility and customization possibilities, I preferred not to use plugins for creating the contact form.
To get it to work for sending emails I had to add this code to my function.php file:
function send_contact_email() { if (isset($_POST['nome']) && isset($_POST['cognome']) && isset($_POST['email']) && isset($_POST['telefono']) && isset($_POST['messaggio'])) { $nome = sanitize_text_field($_POST['nome']); $cognome = sanitize_text_field($_POST['cognome']); $email = sanitize_email($_POST['email']); $telefono = sanitize_text_field($_POST['telefono']); $messaggio = sanitize_textarea_field($_POST['messaggio']); $to = ‘[email protected]’; $subject = 'Nuova richiesta di contatto'; $message = "Hai ricevuto una nuova richiesta di contatto:\n\n"; $message .= "Nome: $nome\n"; $message .= "Cognome: $cognome\n"; $message .= "Email: $email\n"; $message .= "Telefono: $telefono\n"; $message .= "Messaggio:\n$messaggio\n"; $headers = array( 'From: ' . $nome . ' ' . $cognome . ' <' . $email . '>', 'Reply-To: ' . $email ); $result = wp_mail($to, $subject, $message, $headers); if ($result) { $confirmation_message = 'Grazie per averci contattato! Ti risponderemo al più presto.'; } else { echo 'Si è verificato un errore durante l\'invio della richiesta di contatto. Per favore, riprova più tardi.'; } } } add_action('template_redirect', 'send_contact_email');
Only one problem remains. As you can see the php code expects two different messages, depending on whether the submission was successful or not.
I used two different ways to test both.
The one with simple “echo ” is not good, as it inserts the response in the wrong place of the web page.
Instead with the “$confirmation_message ” I should be able to insert the message anywhere in my html.
So I try by entering this code:
<?php if (isset($_SESSION['confirmation_message'])) { echo '<div class="confirmation-message">' . $_SESSION['confirmation_message'] . '</div>'; unset($_SESSION['confirmation_message']); // Rimuove il messaggio di conferma dalla variabile di sessione dopo averlo mostrato } ?>
Unfortunately it doesn’t work.
Do you have any fix or solution to suggest?Thanks again!
Forum: Developing with WordPress
In reply to: Call a slug category by current pageHere I am again for one last need: I would like to add a piece of code to the page to show in case there are no posts.
For example:
<?php else: ?> <p>No posts found. :(</p> <?php endif; ?>
Can you tell me what I can write or where to add this piece of code in my code reported in the opening post?
Thank you!
Forum: Developing with WordPress
In reply to: Call a slug category by current pageHello, I am writing here again because I have another similar need.
I would like all posts of a certain category to be displayed NOT according to the current category, BUT according to the current PAGE.
I specify that, if it were useful for my purpose, I can name the slug of the page equally to that of the respective category.
I gave it a try by making a change to the code you recommended above:
$category = get_queried_object(); $slug = $page->slug;
Unfortunately it doesn’t work.
Can you still support me?
Many thanks!
EDIT: Solved using this code!
global $post; $post_slug = $post->post_name;
- This reply was modified 1 year, 10 months ago by ivanisevic82.
Forum: Developing with WordPress
In reply to: Call a slug category by current pageThank you, it works perfectly!
Many thanks Thaikolja, everything is clear!
I have only one doubt left: I read in your replay that some problems could occur only in the use of some child themes, I think perhaps as a result of an update.
Since I don’t use third-party themes but only a theme made by me (non-child), can you confirm that that remote risk doesn’t exist in my case?
Thanks again!
Forum: Fixing WordPress
In reply to: Different behavior of the title in pages and postsHi, I fixed it!
Actually the “h1” tag containing the title was not formed automatically in each post by WordPress, but it was part of my code present in single.php
I just deleted it and fixed the problem.
Hi, I fixed it!
Actually the “h1” tag containing the title was not formed automatically in each post by WordPress, but it was part of my code present in single.php
I just deleted it and fixed the problem.
The plugin works great, thanks a lot!
I’m left with just a little fear: this plugin is very important for my site because I’ve changed a big part of the structure of my theme according to the subtitle that I can implement thanks to this plugin.
I wonder: if in the future the creator no longer supports the plugin or withdraws it from wordpress, would I risk having to completely modify my site?
Or in the event that the creator wants to withdraw it from wordpress, once downloaded and activated on my site it can no longer be removed and the only problem will be not having it updated anymore?
Thanks again for the assistance!
I’m editing my post adding an update: I managed to solve the problems listed above, simply by inserting the part of the code related to adding titles and subtitles in “page.php” file, instead of “header.php”.
Originally I had title and subtitle position in the header because they will be displayed in that area of the page.
However, to solve the problema that I had title and subtitle in ALL the pages of the site (since header.php is called in every page), I was forced to insert title and subtitle in page.php and to work on the css in order to style correctly the position of the elements in the header, using a negative margin-top.
I would like to know if this solution seems correct to you.
Also I still need support for a second problem.
I would like to be able to integrate title and subtitle in posts as well (and not only in the pages)
These elements has to be displayed in the header, as happens in the pages, with the title (H1) and subtitle (H2) style.
However, there is a problem in the posts that does not occur in the pages.
In fact, when I enter a title on the pages, this is not displayed by default on the web page, therefore I only correctly display the title called by the PHP function “the_title” (in addition to the subsequent “get_secondary_title”). Conversely, when I insert the title into a post, wordpress AUTOMATICALLY creates an H1 element which it inserts into the page.
In this way I have a duplication of titles: the first one called by the “the_title” function; the second inserted automatically by wordpress.
However, I don’t want to forcibly delete the wordpress H1 title, as it would not only delete the post header, but also all the other titles (for example those listed in the post archive).
How can I solve this problem?
Thanks again for the support!