WP Container Displaying Only on First Page of Archive

I have the following code for a two-column container: <div class="rh_content rh_content_above_footer rh_page__content"> <div class="wp-container-3 wp-block-columns"> <div class="wp-container-1 wp-block-column"> <h2 style="font-size: 19px;color: #36a8fc;">Trouvez à Altea l’appartement répondant à tous vos critères</h2> <p>Souhaitez-vous une, deux ou trois chambres ? Plutôt vue sur l’extraordinaire arrière-pays, ou sur la mer ? Votre rêve, c’est plutôt terrasse ou jardin privatif ? Et côté architecture ? Votre préférence va-t-elle vers le style méditerranéen typique, ou vers une architecture résolument moderne ? Comme vous le voyez, de nombreux choix sont possibles.</p> …
Category: Web

I want to display latest post in marquee

<?php /* Plugin Name: Breaking News */ function rif_breaking_news(){ ?> <div class="breaking_news_box" style="background: none repeat scroll 0 0 #2E8B57;bottom: 0;color: #CCCCCC;direction: ltr;height: 32px;left: 0;min-width: 600px;position: fixed;width: 100%;z-index: 99935;" id="breaking_news"> <b class="breaking_head">Latest News:</b> <ul style="margin:4px;"> <marquee behavior="scroll" direction="left" scrollamount="3" scrolldelay="60" onmouseover="this.stop()" onmouseout="this.start()"> <?php $latest = get_posts('numberposts=5'.'&offset='.'&cat=13'); foreach( $latest as $post ): ?> <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>     <?php endforeach; ?> </marquee> </ul> </div> <?php } add_action('wp_footer','rif_breaking_news'); function rif_css_fileLink(){ echo '<link rel="stylesheet" type="text/css" href="'.plugin_dir_url(__FILE__).'css/style.css" >'; } add_action('wp_head','rif_css_fileLink'); ?>
Category: Web

Redirect after login to current URL

I've my login box on any page of my WordPress and I'm trying to redirect to the same page after a user logs in. For example: If I make the login in the URL http://localhost/wordpress/category/sub-category/sold, redirect to the same URL. I've this in my functions.php but, using my $url doesn't work. How can make the redirection? function login_go_home(){ //$url ="http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; wp_redirect(home_url()); exit(); }
Category: Web

wp_nav_menu displaying all pages

As the title says, I'm using wp_nav_menu in header.php to load in the audience, secondary, and main menus and when I do, every menu contains every page - or at least many more pages than I selected for the menus. I'm having the hardest time trying to make this work for some reason, so any help is appreciated. Here's the code to register the menus in functions.php: // WordPress Menu Locations function diviecommerce_setup() { register_nav_menus(array( 'primary' => esc_html__( 'Main Menu', …
Category: Web

WordPress 6.0 upgrade caused my custom function to stop working

Not working on WordPress 6.0: https://thealliance.health/for-providers/resources/provider-news-archives/ Working dev site on WordPress 5.9.3: https://ccahdev.wpengine.com/for-providers/resources/provider-news-archives/ Here is the function if somebody can spot what may have been deprecated: function wpb_postsbycategory2022() { $posts = get_posts( array( 'category_name' => 'Provider News', 'nopaging' => true, 'orderby' => 'date', 'order' => 'DESC', // it's DESC; not DSC // There's no use setting posts_per_page when nopaging is enabled. // Because posts_per_page will be ignored when nopaging is enabled. ) ); $_year_year = ''; // previous years value …
Category: Web

How to get correct URLs in network wide menu (Multisite)?

I'm using this function to switch to my main website's navigation and display it on all sub sites in my multisite network. Ideally the links should have the following format: http://www.mysite.com/navigation-link but on the sub-sites the urls are http://www.mysite.com/subsite/navigation-link Obviously these pages don't exist so it's just showing a blank page. Any idea how I could make sure the urls are like the first example and how I might incorporate that into my function? function wp_multisite_nav_menu() { global $blog_id; $args …
Category: Web

Only Show One Category Name Per Post

I wrote a function to only show a limited number of recent posts per page, and it works fine. But I also want to display only one category-name per post (even if the post has several others), I just want it display the first [0] category from each post. I've spend hours on this and I've gotten very close, but just end up with the posts showing all categories on a list, like when using <?php the_category(" "); ?> I …
Category: Web

Using a function to change favorites listing

Sorry - total newbie here with Wordpress development. I have the following plugin installed https://favoriteposts.com/ and it allows you to change the default output of the users favorites by using the following function: /** * Customize the Favorites Listing HTML */ add_filter( 'favorites/list/listing/html', 'custom_favorites_listing_html', 10, 4 ); function custom_favorites_listing_html($html, $markup_template, $post_id, $list_options) { return $html; } I just don't know how to use this. What I would like is for the output to match that of the default woocommerce product …
Category: Web

how to scraping website data to wordpress taxonomy

i want to scrape data from another website that doesn't provide api to my wordpress site, and i want when i input the data url ($baseTarget) it appears directly in the taxonomy input post_tags, title description, category, image etc in new post. i don't know how to make it, i have searched but haven't found any results. scrape.php <?php namespace App\Services; use voku\helper\HtmlDomParser; class MALService { private $baseTarget = 'https://myanimelist.net'; private function init($path) { $curl = curl_init($this->baseTarget . $path); curl_setopt($curl, …
Category: Web

Add php code to wp_print_scripts?

Is there a way to add inline php code to the editor using wp_print_scripts? I'm trying to find a way to display text from a php string into a value of input of a block. Here's my code: function shapeSpace_print_scripts() { ?> <?php $block_yt_url = 'test';?> <script> jQuery(document).ready(function ($) { let $yt_url = false; $(document).on( "click", '#yt_run .acf-button-group', function() { $(".editor-post-publish-button__button").hide(); $(".acf-block-body div div.acf-block-fields.acf-fields div.acf-field.acf-field-text.acf-field-6260f423f1666").css({'height':'inherit','padding':'16px 20px','overflow':'inherit'}); $(".acf-block-body div div.acf-block-fields.acf-fields div.acf-field.acf-field-text.acf-field-6260f423f1666").val(<?php echo $block_yt_url;?>); $('#yt_url .acf-input input').keyup(function(e) { if(e.keyCode == 13) { …
Category: Web

Restrict user registration to emails on a single domain

I need to allow user registrations only for those with email addresses on a single domain. I have tested multiple regular expressions and this one works well in a regex sandbox environment, but as soon as I put it into my functions.php file, it simply rejects all registrations - even email addresses on the correct domain (with the error message below, so it's definitely this conditional that's breaking it). Am I: a) actually doing something stupid in the regex, even …
Category: Web

Get post id outside loop : Notice: Trying to get property of non-object

I am trying to get the post id outside the loop in functions.php.but what error i am getting : Notice: Trying to get property of non-object in functions.php on line 549 function theme_myeffecto_disable() { global $wp_query; $post_id = $wp_query->post->ID; $showreaction = get_post_meta( $post_id, 'post_reaction_show', true ); $showreaction = isset($showreaction) ? $showreaction : true; var_dump($showreaction); } add_action( 'init', 'theme_myeffecto_disable', 20 ); and $showrating always comes false weather it is true or false :(
Category: Web

Ajax not working to insert, query and result data

On my site, through a form I send/register same information in database, do a SELECT/query and return it! Return the last table saved in database, just that user just entered on the form (along with some more information coming from the database). How I want to display these values coming from databse in a modal bootstrap it's necessary that the page doesn't give the refresh. For this, I inserted the AJAX as follows: $(document).ready(function(){ $('#enviar').click(function(){ $.ajax({ //CAAL AJAX IN WORDPRESS …
Category: Web

Getting text from custom field from customizer

So I've created a panel in the customizer section in WordPress to add the phone number to the site. It works fine in the back end but it wont show up in the front end here is my functions.php function home_smart_register_theme_customizer( $wp_customize ) { $wp_customize->add_panel( 'contact_info', array( 'priority' => 10, 'theme_supports' => '', 'title' => __( 'Contact Info', 'home_smart' ), 'description' => __( 'Set your current address.', 'home_smart' ), ) ); $wp_customize->add_section( 'contact_details_block' , array( 'title' => __('Phone Number','home_smart'), 'panel' …
Category: Web

Dynamic URL Rewrite for Custom

I have a custom post type called Hotels which I woud like to link to using the below url structure: /{country}/{state}/{hotel-name} I am fetching and inserting posts dynamically, so I do not know the number of countries/states. The Hotel Name is the slug version of the post title. I have been banging my head all day trying to get it to work. The below code works to make the links look correct, but then 404s on all posts: function change_link($permalink, …
Category: Web

Search not showing all results

EDIT: So I've done some troubleshooting and it seems my theme isn't showing woocommerce search results. The 2017 theme does so I am trying to figure out what my theme is missing. I suspect something in the functions.php file. It's something I'm leaving out, not something I've included that's interfering, because I deleted all my code out of the functions file line by line and nothing changed. I have some custom code I have used elsewhere without any trouble. I …
Category: Web

How to change or add user role after getting post request data about pay?

How to change or add user role after getting post request data about pay? qiwi2.php file in theme folder: <?php include($_SERVER['DOCUMENT_ROOT'].'/wp-load.php'); $qiwi = [ "public_key" => "*", "secret_key" => "*", "successUrl" => "https://someurl/" ]; $secret_key = $qiwi['secret_key']; $sha256_hash_header = $_SERVER['HTTP_X_API_SIGNATURE_SHA256']; $entity_body = file_get_contents('php://input'); $array_body = json_decode($entity_body, 1); $amount_currency = $array_body['bill']['amount']['currency']; $amount_value = $array_body['bill']['amount']['value']; $billId = $array_body['bill']['billId']; $siteId = $array_body['bill']['siteId']; $status_value = $array_body['bill']['status']['value']; $account = $array_body['bill']['customer']['account']; $invoice_parameters = $amount_currency."|".$amount_value."|".$billId."|".$siteId."|".$status_value."|".$account; $invoice_parameters=(string) $invoice_parameters; $sha256_hash = hash_hmac('sha256', $invoice_parameters, $secret_key); if (!empty($sha256_hash_header) && strcmp($sha256_hash_header, $sha256_hash) …
Category: Web

Workaround for og:image unsupported webp image type, Yoast SEO?

My site Beta Fox uses Yoast SEO plugin to help deal with SEO common practices, however an issue has arisen. In beginning of last year WordPress didn't fully support webp image types, neither Yoast SEO. Things changed near the end of year, but Yoast SEO unbelievably refuses to support webp (the types Google is forcing upon on us to use). The problem is the fact there's no open graph for image attachments in any page of the site, so that …
Category: Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.