Adding a Cookie Session to Shortcode Content

Welcome to WordPress Development StackExchange site! In general you understand everything right, but there can be one important caveat: if some page content like page header, navigation menu, etc is already sent to the user, a try to set cookie from PHP script will give a following error: “Cannot modify header information – headers already … Read more

i have create shortcode that work but not perfect coding

So, there are 2 wrong things. First of all, your shortcode itself is wrong. You used [check-if-equal usermeta=”firstname” uservalue=”Jeff”] Yes [/check-if-equal] but there is nothing like firstname in WordPress, It’s first_name So your shortcode should look like this, [check-if-equal usermeta=”first_name” uservalue=”Jeff”] Yes [/check-if-equal] Once that is done, rest looks cool I edited the question itself, … Read more

How do I display “Hello username” if logged-in on the homepage

try my variant: <?php if (!is_user_logged_in()) : ?> <form action=”<?=get_home_url(); ?>myaccount” method=”POST”> <input type=”submit” value=”<?php _e(‘Hello, Client! Click to sign in:’, ‘theme’); ?>”> </form> <?php else: ?> <a href=”<?=get_home_url();?>myaccount”><?php _e(‘Hello ‘, ‘theme’); echo wp_get_current_user()->user_login;?></a> <a href=”<?=wp_logout_url(esc_url( ‘https://’. $_SERVER[‘HTTP_HOST’] . $_SERVER[‘REQUEST_URI’] ));?>myaccount”>Logout</a> <?php endif; ?>

Nested Code Snippets [closed]

I managed to get it work by creating one code snippet: function render_album_list_item($album) { $output=”<div><figure>” . get_the_title($album) . ‘ </figure></div>’; return $output; } function display_albums_shortcode() { $query = new WP_Query( array( ‘post_type’ => ‘albums’ )); $output=”<section>”; if ($query->have_posts()): while ( $query->have_posts() ): $album = $query->the_post(); $output .= render_album_list_item($album); endwhile; endif; $output .= ‘</section>’; wp_reset_postdata(); return … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)