Ordering Posts List By Taxonomy Terms?

WordPress core (as expressed by involved people on multiple occasions) strongly discourages sort by terms. It sees terms as exclusively grouping mechanism, with no ordering capabilities implied. So in your specific case WP would understand that there are different directors, that there are groups of shows done by those directors, but won’t at all understand … Read more

how to get the title, description, pictures on the page?

Try the same thing with get_children. It will get you. Here is an sample code for you. $args = array( ‘numberposts’ => -1, ‘order’ => ‘ASC’, ‘post_mime_type’ => ‘image’, ‘post_parent’ => $post->ID, ‘post_status’ => null, ‘post_type’ => ‘attachment’, ); $attachments = get_children( $args ); if ( $attachments ) { foreach ( $attachments as $attachment ) … Read more

Create a variable with string, array or multiple values

the last $file takes priority over the previous That’s because you assign the new value to the $file variable at every line. The only way I see you can do it by using the array: <?php // define directory list $directories = array( ‘home’, ‘pages’, ‘blog’, ‘single-posts’, ‘products’, ‘templates’, ‘products’ ); // run through directories … Read more

Need help in creating splash intro page using custom page template

Let’s go from the beginning. First I’ll walk you through the enqueing of styles and scripts. In your functions.php file add: add_action( ‘wp_enqueue_scripts’, ‘splash_intro_scripts’); if ( ! function_exists( ‘splash_intro_scripts’ ) ){ function splash_intro_scripts() { if (is_page_template(‘page-intro.php’)) { wp_enqueue_style(‘google_font_1’, ‘https://fonts.googleapis.com/css?family=Arvo&subset=latin,latin-ext’); wp_enqueue_style(‘google_font_2’, ‘https://fonts.googleapis.com/css?family=Josefin+Sans&subset=latin,latin-ext’); wp_enqueue_style(‘google_font_3’, ‘https://fonts.googleapis.com/css?family=Josefin+Slab&subset=latin,latin-ext’); wp_enqueue_script( ‘bootstrap’, get_stylesheet_directory_uri().’/js/bootstrap.js’, array( ‘jquery’ ),”, false ); wp_enqueue_script( ‘blocs’, get_stylesheet_directory_uri().’/js/blocs.js’, array( … Read more

Using a page-template to restrict access based on IP (Frontend)

Now I have it working! In the meanwhile Jeff Cohan also gave the right advice on how to do it (see his comment on the question). Here’s my full code, working the way he suggested: function getUserIP() { $client = @$_SERVER[‘HTTP_CLIENT_IP’]; $forward = @$_SERVER[‘HTTP_X_FORWARDED_FOR’]; $remote = $_SERVER[‘REMOTE_ADDR’]; if (filter_var($client, FILTER_VALIDATE_IP)) {$ip=$client;} elseif (filter_var($forward, FILTER_VALIDATE_IP)) {$ip=$forward;} … Read more

Fetching $_POST from Page Template into functions.php

Assign the value of you $_POST variable to a html element or javascript variable in front-page.php like //html element <input type=”hidden” value=”<?= $_POST[‘variable’]?>” id=”post-variable”> or in javascript variable var postVariable = “<?= $_POST[‘variable’]?>”; Now in ajax call, you can get the value as var myValue = jQuery(‘#post-variable’).val(); //if you set value to html element or … Read more

require happens out of order

Must be something with your setup. Following works for me (inside child theme – should work for any theme though): single.php: global $post; $bla = $post->post_title; error_log(‘post title is: ‘ . $bla); include(‘included.php’); included.php: error_log(‘i am included file: ‘ . $bla); Output in debug.log: post title is: Hello test i am included file: Hello test … Read more