Articles of page template

How to pass outside function to WP_REST_Request

Learning with WP REST I’m unsure how to properly pass what is typically at the beginning of a PHP page form to WP_REST_Response. For example: At the beginning of page-foobar.php if I have: // IP ADDRESS function ipAddress() { if (isset($_SERVER[‘REMOTE_ADDR’])) : $ip_address = $_SERVER[‘REMOTE_ADDR’]; else : $ip_address = “undefined”; endif; return $ip_address; } /* […]

shortcode javascript not working on custom template file inside theme folder

I’m using WordPress social login plugin shortcode [wordpress_social_login]. I want to put it in custom template file inside theme directory. example: <?php /* Template Name: Social Login Page */ echo do_shortcode(‘[wordpress_social_login]’); so I create a blank page using this template, the rendering is ok but the button href become javascript:void(0); and it won’t redirect. i […]

How to pass a numeric id to a page template?

I am using a WordPress installation with WordPress Social Login as a “canvas” for an HTML5-based board game. In the file /wp-content/themes/twentythirteen-child/front-page.php I get the numeric ID of the viewing user (returned by wp_get_current_user() method) and then her or his Facebook data (id, first name, last name, gender) from the $wpdb->prefix . ‘wslusersprofiles’ table – […]

Is it possible for a plugin to register a page template file?

Is there a way for a plugin to house page template files and have them available after plugin activation? E.g, I have a plugin that requires specific page page templates to be used, so I’d like them to be available in the Page Attributes meta box in the Editor. But in an attempt to keep […]

php ajax problem – weird 301 responses!

hey guys, I really really need your help. I have just no idea why that happens. I’m trying to load a wordpress page with the jquery $ajax method. However my browser is crashing all the time when I try to load this page. I’ve build a kind of ajax search that requests a wordpress page […]

Problem after renaming wordpress template file

After renaming the files of my templates and inside the file with php, it is looking for the old templates. The dropdown is no longer available. Why is this happening and how to fix that? The only files i modified is the template-parts folder inside the child theme. I did not touch the class-wp-theme.php where […]

Change template dynamically

Is it possible to change the template loaded for a page, as it loads, without having to change the record in the database? I suspect it can be done with the template_redirect action, and the will probably have something to do with the template-loader.php file in the WP core, but I can’t figure it out. […]

How do I create multiple page while active a theme

I want create 5 pages when user active my theme. I found a code from wpcanyon which can create one page only. From this code how do I create 5 pages without repeat it 5 times. if (isset($_GET[‘activated’]) && is_admin()){ $new_page_title = ‘This is the page title’; $new_page_content = ‘This is the page content’; $new_page_template […]

Troubles with making a custom template for posts

Is it possible to make a template for all posts in a custom post type? For example I would like to be able to change an adsense ad or some other element on every post by simply editing a custom template. I have been experimenting with templates that are pretty static, but I am stumped […]

Adding the Admin Bar to a page with a custom template

I created a stripped-down page template to use for my landing pages. But I must have cut too much out of it, because I’ve lost the WordPress 3.1+ Admin Bar. What functions do I need to call to get the Admin Bar to appear at the top of the page again?