Wordpress 테마로 만든 플러그인에서 몇 가지 기능을 추가하려고하지만 약간의 기쁨이 있습니다. 설명서는 문제를 해결하는 데 도움이되지 않으므로 여기 누군가가 도움이 될 것입니다.Wordpress : A의 테마에서 플러그인의 기능에 액세스하기
나는 워드 프레스에서 활성화되어 잘 작동하는 플러그인이 있습니다. 이 플러그인을위한 클래스는 Wordpress Theme에서 접근하고자하는 generateHtml이라는 함수를 가지고 있습니다. 그러나 무엇을 시도하든 플러그인 코드에 액세스 할 수없는 것 같습니다.
플러그인 :
<?php
/** Usual comments here **/
if (!class_exists("ImageRotator")) {
class ImageRotator {
private $uploadPath = '';
private $pluginPath = '';
private $options;
function __construct() {
$this->uploadPath = dirname(__file__).'\\uploads\\';
// add_shortcode('imagerotator', array(&$this, 'generateHtml'));
}
// Various functions for plugin
function generateHtml() {
echo '<p>Hello World</p>';
}
}
}
/**
* Create instance of image rotator
*/
$imageRotator = new ImageRotator();
/**
* Create actions & filters for Wordpress
*/
if (isset($imageRotator)) {
// Actions
add_action('admin_menu', array(&$imageRotator, 'createMenu'));
add_action('admin_init', array(&$imageRotator, 'registerSettings'));
add_action('imagerotator_show', array(&$imageRotator, 'generateHtml'));
}
는 나에게 내가 플러그인에서 테마 액세스 코드를 얻을 수 및/또는 내 코드에서 잘못된려고하고있다가 지적해야 할 일의 요약을 제공 할 수 있습니다 테마 헤더 페이지에서
부분 :
<?php if (isset($imageRotator)) {
$imageRotator->generateHtml();
} else if (isset($ImageRotator)) {
print_r($ImageRotator);
} else {
echo '<p>Nope!</p>';
}
if (function_exists("imagerotator_show")) {
echo 'Function found';
} else {
echo 'Function NOT found';
}
?>
현재 내가 볼 모두가 "아니"와 "찾을 수없는 기능"입니다. 모든 입력에 감사드립니다.
리, 우선 들어
부수적으로, 이것은 모든 WordPress의 테마 디자이너에게 도움이 될 것입니다 : http://devideas.blogetery.com/testing-wordpress-themes-easily/ – Sarfraz