The tag has no usage guidance.

learn more… | top users | synonyms

1
vote
2answers
474 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 ...
3
votes
1answer
92 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
27 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 ...
0
votes
2answers
595 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 ...
3
votes
3answers
86 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
24 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
31 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
15 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
22 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
48 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
1k 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
197 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
69 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? ...
32
votes
4answers
18k 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. ...
1
vote
1answer
24 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
18 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
3answers
2k 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
2answers
195 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
77 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
95 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
140 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
0answers
22 views

Includin WP outside the loop but not all function are working, why?

I have to deal with a strange setup, where i have a subdomain (non-wp) and a domain.com (wp). I need the wordpress data to be available in the submdomain so i add ...
0
votes
1answer
320 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 ...
1
vote
3answers
12k 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 ...
2
votes
3answers
866 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
92 views

path-based multisite: Including wp-load.php in external page redirects page to blog

I have a multisite setup at foo.com/school/blog. Now when I try to include wp-load.php on bar.com it redirects the page to foo.com/school/blog. bar.com is an ad on domain and points to foo.com/test. ...
0
votes
0answers
57 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
37 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
56 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
62 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
579 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
324 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
33 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
944 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
121 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 ...
0
votes
1answer
131 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
2answers
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
25 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
60 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'); ...
4
votes
3answers
7k views

How to prevent wordpress from loading old versions of jquery in wp_head();?

I noticed my twenty twelve theme is including outdated versions of jquery and js so I want to replace the scripts with the newer versions, however the scripts are in the file included by wp_head() ...
0
votes
1answer
51 views

Pages included in another page and duplicate content issues for SEO

in a recent project I've decided to create a page template (PageX) which is a kind of "stack" of subpages. This template simply includes the content of three other separate pages (PageA, PageB, ...
0
votes
1answer
155 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
173 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
167 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 ...
0
votes
1answer
256 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 ...
0
votes
1answer
83 views

How to include a post type in the admin/backend?

I'm changing the backend/admin and want to show a div above the pages. How can I include the pages like the example; <?php include('./tools.php') ; this works but when I choose edit.php / ...
0
votes
2answers
375 views

Conditionally include files in functions.php?

I have a bunch of functionality being added to a Wordpress site including files in functions.php but I'm worried about performance. All of these files are included for every page request and not all ...
2
votes
3answers
20k views

Include a external PHP file into a Wordpress Custom Template

Is this even possible? I mean, im trying to add a blog into my site.. I already have the header,footer and sidebar layout in my site. can i use those in my custom wordpress template? <?php /* ...
1
vote
1answer
181 views

include php file if page_id matches

I think this is a simple question: I'm building a plugi, and up until now, if i wanted to include a php file, i would have to know the page_id - i would put the following command in page.php (or ...
0
votes
0answers
20 views

Linefeed added after include/require in PHP

I am using the following script to protect downloads from the wp-upload dir: (https://gist.github.com/hakre/1552239) It should work fine, however there is a linefeed created by the ...