The tag has no usage guidance.

learn more… | top users | synonyms

1
vote
1answer
29 views

Automatically include all php files in a child theme directory

I'm currently using a custom child theme across multiple sites, and would like to modularise particular custom features (e.g. ecommerce) by separating them into individual php files, and including the ...
0
votes
0answers
37 views

Including wordpress core in php script impact on load speed

I'm using require('wp-load.php'); to be able to use wordpress's functions outside of wordpress. My question is, how much impact does this have on performance? Will it like double the load or ...
0
votes
2answers
28 views

Push Shortcode parameter to template

I'm trying to push a shortcode parameter value to a template file but for some reason I can't get the array value that I'm targeting into a single variable. Here is my code and the shortcode I'm ...
0
votes
1answer
15 views

Include file from higher level

I created a custom page template where I want to present some data specific for that page. The file is placed in wp-content/themes/themename/page-templates In that file I want to include ...
0
votes
2answers
42 views

Correct and safe way to include php content in my page

I have a website where I use [insert_php] to insert php content to my page. What I do is simply use php's include inside insert_php to include my complex php script. I asked a question a while ago, ...
0
votes
1answer
17 views

require happens out of order

I have a page template that is including another file via require_once. I want this included file to have access to the $post object but it can't find it. So I ran something like this to see what's ...
1
vote
2answers
29 views

Include comments form in plugin page

I want to include the comments form on a page generated by my plugin. I got the post id I want to attach the comments to, but I can't get any of the Wordpress comments functions to work. Tried to ...
1
vote
2answers
76 views

External system integration with wordpress

I'm writing a web/db application. My clients would like authentication based on whether the user is logged into WordPress. Assuming this application is hosted from within /wordpress I would like to ...
3
votes
1answer
46 views

Why does get_template_part() break variables?

In PHP, when you include a file, the variables you're using in your current scope are available for use in the included file. When using WordPress's get_template_part(), variables are no longer ...
1
vote
2answers
31 views

Custom theme: Alternatives to long list of 'include' in functions.php

I'm building a custom theme for in-house use only. I started by putting a lot of the core functions in plugins, but then that seemed silly since they don't require any user interaction. Next, I put ...
0
votes
1answer
64 views

Include tags from array, ignore the rest in get_the_tags

I'm trying to exclude a large amount of tags from being displayed in get_the_tags function. I have successfully excluded tags using this code: <?php $links = array(); foreach ...
0
votes
1answer
85 views

using `require` in my functions.php breaks the site

So, I have a snippet of code I'd like to tidy away in a directory that's close to the root my wordpress directory. Specifially it lives in /includes/inc. I've created a file called test.php and ...
0
votes
1answer
126 views

the 'proper' way to include/require php files in wordpress

I'm a new WP dev and recently I've been having problems (on multiple sites) with include[_once] and require[_once] for PHP files. If I include (get_theme_directory_uri() . 'subdir/file') the specified ...
0
votes
2answers
69 views

Add few specific post ids to wp_query

I have following args to get recent posts, $args = array( 'date_query' => array( array( 'after' => '1 week ago' ) ), 'posts_per_page' => 15, 'ignore_sticky_posts' => 1, ...
0
votes
1answer
87 views

require_once not working

I have a custom page template, and this template need to include one php file. I tried to put this script require('.../hc-v2-child/ayah.php') and this require(__DIR__.'ayah.php'); in functions.php ...
-1
votes
1answer
165 views

How to include a php file in every post and page [duplicate]

How to automatically include a php file in all posts and pages. The php file I want to add has a script which will automatically fetches a temporary video link every time the file is executed.
0
votes
0answers
19 views

Creating Action Hooks For Automatic File Inclusion

I want to create a hook for automatic file inclusion in my plugin, but I am finding my stuck moments. May be somebody could help me out. Here is what I tried: $args = array( "url" =>"" ); ...
4
votes
1answer
498 views

Problem requiring/including plug-in files with plugin_dir_path( __FILE__ )

I am trying to write a WordPress plug-in. In my project I have three PHP files. My plug-in file Widget for the plug-in Data installation I need to install data table on plug-in activation. For ...
0
votes
0answers
31 views

how to include js in widget?

I know about wp_enqueue_script. i just wanted to make sure that it applies here. I built a custom widget that uses a lot of js. Most of that js is included in a separate file that gets included from a ...
4
votes
3answers
2k views

How do I replace a function, declared inside a plugin's class, in functions.php?

I want to modify a function in a plugin. It is declared in the plugin's main file like this: class WCPGSK_Main { ... public function wcpgsk_email_after_order_table($order) { ... } } Add ...
0
votes
0answers
241 views

Using require_once for parent-directory not working but is working in sub-directories

I'm building a custom theme and I'm attempting to use require_once __DIR__ . '/templates/variables.php' in my footer.php file, to keep from repeating code that contains variable information... I keep ...
0
votes
1answer
305 views

Include Class File in Wordpress

I'm including a Class file in functions.php file require_once get_template_directory() . "/core/classes/General.php"; require_once get_template_directory() . "/core/classes/User.php"; When I do ...
0
votes
0answers
24 views

remove file plugin include

i use a plugin that include template.php file , i want to replace this with a new one in my template directory or remove it class jqueryTimelinrLoad { public function shortcode($atts, ...
0
votes
0answers
34 views

Include two parts of multiple blogs in external Website

so i'm really stuck in here. From the structure i got 2 Blogs and 1 External Page. I would like to include from 1 Blog the Header, and from the other Blog the sidebar. I figured out how each of them ...
0
votes
1answer
126 views

Include files in functions.php

This is a rewritten post since the way I worded my old post totally confused everyone. MikeSchinkel shows how he uses Include files in his theme's functions.php file In this Stackexchange post: ...
1
vote
3answers
158 views

PHP files included in functions.php don't seem to work

This is my first post on WordPress StackExchange, I'll try to be precise. My question is: Is there anything in particular I should do to the files I'm including in my theme's functions.php file? ...
1
vote
1answer
27 views

How to display / include a specific jpg on a page

is it possible to show / include a specific jpg on a WordPress page? I have made 365 jpg's, one for each day of the year and want to display the jpg belonging to that day of the year on the specific ...
0
votes
0answers
32 views

How do I remove_action for the function from included file

I'm building a theme and trying to reuse code from another file in my header.php by doing this: include_once( get_stylesheet_directory() . '/root-theme/header.php' ); This include works fine. But ...
0
votes
2answers
1k views

Unable to check if plugin is active

I am working on a custom theme using ACF. I would like to check if the plugin is active or not. I am using this code: <?php include_once( ABSPATH . ...
0
votes
2answers
148 views

if statement parent page for child pages

im trying to achieve a code to include a file into pages, these pages has a parent page. so instead of repeating the code of the "if statement" i use this function but doesn't work. i want any page ...
1
vote
1answer
110 views

WP Plugins - Use includes to display page content

So I have a plugin I have been working on. It adds a menu and multiple submenus. Each submenu page contains a form, this form is created in a function called add_content_submenupagename. This ...
0
votes
2answers
237 views

Shortcode not passing variable to included file

I set up a shortcode which includes a standard php/html form file. In the form I have a hidden field where the value is a variable which is meant to be available in the form via the shortcode ...
0
votes
1answer
648 views

wp_star_rating() - Adding a 5 star rating system to theme

My goal is to add a 5 star rating system to my theme. I read that there's a function wp_star_rating in wp-admin/includes/template.php on line 2121, that I've been trying to use for the ratings. I am ...
0
votes
0answers
89 views

sharing wp-include - wp-admin on same installation

This is not a security or privacy issue.. I have multiple wp installations (usually a couple for project), so in the next installation I'll be setting up I'm thinking of cutting down some space ...
0
votes
1answer
54 views

Theme parts path location dump

Few months back I was working on customizing theme that I was assigned to. I remember that I used some function or define something in the config or theme functions file and than it displayed debug ...
1
vote
2answers
689 views

How to pass variables with get_template_part?

I am developing a custom theme and i like to pass some variables to selected files. I am calling the view files from functions.php. $var1 = ; $var2 = ; etc ...
0
votes
2answers
70 views

wordpress.org disallowing my plugin becuase of loading core files in cron cpanel file

I made a plugin and trying to install on wordpress.org but Wordpress is giving me error message that ## Calling core loading files directly is incorrect. I am using a cron file in my plugin.This cron ...
0
votes
0answers
112 views

template_redirect and title

I pass a template_redirect in wordpress as hook but I want to have a personnalized title for this page and I miss to do that. Has someone any idea ? add_action( 'template_redirect', 'virtual_pages' ...
0
votes
3answers
872 views

Include files in child themes, declare in functions.php

I'm using a child theme. I want to make a change to a file which currently resides in: mybasetheme>includes>sf-content-display>sf-post-layouts.php So I copied the exact same file structure into ...
0
votes
1answer
489 views

Variable scope producing undefined variable notices in included files

I'm building a Wordpress Theme and on the front page the user is able to select how they would like to order their posts. I've then created two functions that take the users selection through the ...
0
votes
1answer
41 views

Include post on external custom site

How do I include single post ( I mean image, title, and a bit of text ) on my own custom site? I have wp in subdirectory and I just want to make "Recent article" box on my site. I was looking for it 2 ...
0
votes
3answers
1k views

After Migration, Warning: include_once() errors on all pages

We migrated our site to a new host and changed the domain name, and now all pages are displaying errors: Warning: include_once(includes/class-wc-download-handler.php) [function.include-once]: ...
0
votes
1answer
187 views

add_action outside a plugin

I'm trying to create my own class to make some of the most common changes I need in all my WP sites. Things like removing the canonical tag when not required or changing the meta description. I'm not ...
1
vote
1answer
238 views

Hardening wordpress: blocking /includes with htaccess

This page http://codex.wordpress.org/Hardening_WordPress says this should be included in the .htaccess file to block requests for files inside the includes dir. # Block the include-only files. ...
0
votes
1answer
75 views

Incorrect search results in search.php – issue triggered by using `define('BodyID', 'search'); the_post();` in search.php

I have a problem where the page title is not picked up in search results. I've narrowed the problem down to the following line of search.php in my custom theme. define('BodyID', 'search'); ...
0
votes
1answer
32 views

Include inside sidebar

Is it possible to include a file inside or inbetween items in a sidebar? Here are the two functions being called: <?php get_sidebar(); ?> <?php get_template_part('testimonial-box'); ?> ...
0
votes
1answer
303 views

How do I / Is it possible to execute an external PHP file / function inside Wordpress?

On my set-up, there is the regular website which consists of a header and content (both printed from separate PHP files located in domain.com/includes/) and a Wordpress blog based in a subdirectory ...
-3
votes
2answers
294 views

php include returns 1 as output with other outputs [closed]

I have this code $return = include(TEMPLATEPATH . '/apex.php' ); $html .= $return; I using the above code to get a php for from a plugin from theme dir. but it returns 1 with the other wanted ...
0
votes
0answers
221 views

Question about file path for include/require methods

So I am currently rather new to Wordpress development and I had a question about the file path for the include() and require() methods. I have a php script within my Wordpress installation that I ...
1
vote
1answer
432 views

How to include core files into plugin

I did some search about this but I don't realize which is the correct way to include a wordpress core file into a plugin. I wish to include the wp-includes/ms-funcition.php file. For example if I ...