What does this if-statement do?: if($pages=’ ‘) {}

$pages is an optional parameter. If not set, $pages will equal an empty string. So if($pages == ”) checks to see if that parameter has been set. In this call, the parameter has not been set: kriesi_pagination(); In this call, the parameter has been set: kriesi_pagination(5); In the tutorial link that you posted, read this … Read more

Please help to know why single.php crashes after I add this code [closed]

You’re missing <?php and ?> <?php if( in_category( ‘movies’ ) ) { // this (end php, start html) -> ?> <span style=”font-size:16px”> <strong>Movie:</strong> <?php the_field( ‘movie_name’ ); ?> (<?php the_field( ‘movie_year’ ); ?>)<br/> <strong>IMDb:</strong> <?php the_field( ‘imdb_link’ ); ?><br/> <strong>Rotten Tomatoes: <?php the_field( ‘rt_link’ ); ?> <br/><br/> </span> <br/><br/> <?php // <- this (end html, … Read more

get user role. parameter id return type string [closed]

You should use WordPress functions to get the user role by user id. Please try code given below: function user_role_parameter($user_id) { $user_meta = get_userdata($user_id); if ( !empty($user_meta) ) { $user_roles = $user_meta->roles; $user_role=””; foreach( $user_roles as $role ){ $user_role .= $role . ‘, ‘; } return $user_role; } else { return “”; } }

Parse error: syntax error, unexpected ‘}’ in C:\xampp\htdocs\admin\products.php on line 148 [closed]

I have updated your code here. so use this below code. you have forgot close this ) in this line like this while ($row=mysql_fetch_object($query)) <tr> <?php include(‘sql_connect.php’); ?> <?php $sql=”select * from hp”; $query=mysql_query($sql); if(mysql_num_rows($query)>0) { $i=1; while ($row=mysql_fetch_object($query)){ ?> <th scope=”row”><input type=”checkbox” /></th> <td class=”tm-product-name”><?php echo $hp_model; ?> </td> <td><?php echo $hp_type; ?></td> <td><?php … Read more

Running a php code after User clicks a button? [closed]

You can wrap your code in a function and use a button to activate it. Create a button and assign a function to it’s onclick event: <span onlclick=”javaSubscribe();”>Subscribe</span> Now, make an AJAX request to your server after clicking the button: function javaSubscribe() { // We need the ID for user and tag. Let’s retrieve it … Read more

php snippets in html are being commented out

You don’t display anything in shorcode’s function, you just return what has to be displayed. Your code should be: function phpTest() { return ‘<p>some text</p>’; } add_shortcode(‘test’, ‘phpTest’); Update: if your function contains anything, which displays data, use it as follows: function phpTest() { ob_start(); // your code goes here return ob_get_clean(); } add_shortcode(‘test’, ‘phpTest’);

What is proper way to use the php if statement? [closed]

I assume you are trying to create a new template file linked to a WordPress page. Additionnal documentation : https://codex.wordpress.org/Theme_Development#Basic_Templates To make so, you would need to do something like this : <?php /* Template Name: My first template file */ get_header(); ?> <!– Main body –> <?php if (1<2) { echo “Add multiple lines … Read more