The tag has no usage guidance.

learn more… | top users | synonyms

0
votes
1answer
24 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
1answer
487 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
2answers
762 views

Include content from one page to another

I'd like to include content from one Page (named "contact_text") to another Page in a specific spot (both of these are WordPress admin pages). I've followed this Stack Overflow thread. However I ...
0
votes
2answers
27 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
41 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
45 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
30 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 ...
1
vote
5answers
16k views

Include PHP file in Content using [shortcode]

Here is what I have I am not having any lucking finding how to simply include a file in the content editor using a shortcode. For Example if I wanted to include form.php inside my Contact Page how ...
36
votes
5answers
23k views

Passing variables through locate_template

While I've typically used include or require on their own to save long term code maintenance I've started to use get_template_part and locate_template as using built in WordPress stuff is always best. ...
0
votes
1answer
63 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 ...
1
vote
1answer
6k views

Get current user data from external PHP page

I have a PHP page at the same level as the template/theme on WordPress. I need to be able to get the current logged in user details from this page. I have tried this: require_once( ...
0
votes
4answers
3k views

Adding rich text editor to my plugin

I'm trying to add a rich text editor to my own plugin. So I googled it first of course and I found several answers on dev4press and Stack Overflow. This code displays nothing so I tried another ...
0
votes
3answers
2k views

the_author() not working outside the loop

I have the following code on index.php and I want to include this line of code (bellow) to display author info on top of the loop. <?php include 'author-top.php'; ?><!--author--> I ...
0
votes
1answer
83 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
125 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
65 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
86 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
163 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" =>"" ); ...
1
vote
2answers
688 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 ...
4
votes
1answer
495 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
240 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
302 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
1answer
2k views

is_plugin_active() returning false on active plugin

So I have the following in an include in my theme file: include_once( ABSPATH . 'wp-admin/includes/plugin.php' ); if ( is_plugin_active( WP_PLUGIN_DIR . '/woocommerce/woocommerce.php' ) ) { ...
0
votes
3answers
249 views

Using WP functions such as the_title() in an included php file

I'm including a php file in single.php, in the loop. Is it possible to use WP variables such as the_title(), the_date(), etc in the included php file?
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
645 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 ...
2
votes
3answers
1k views

Sort users in get_users() in custom order

<?php $blogusers = get_users('include=5,6,2,7,12,8'); foreach ($blogusers as $user) { ... } ?> Right now, these users will sorted by first name. How do I sort this in the order the ...
0
votes
0answers
88 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 ...
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
871 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
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 ...