Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions inc/core/Init.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@ private function define_admin_hooks()
*/
private function define_public_hooks()
{
if (wp_doing_cron()) {
return;
}

$plugin_public = new Frontend\Frontend($this->get_plugin_name(), $this->get_version(), $this->get_plugin_text_domain());
// Registra el hook para la vista del template personal
Expand Down
35 changes: 21 additions & 14 deletions inc/frontend/Frontend.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,26 +86,25 @@ private function the_personal_meta($name)
*
*/
public function single_personal_template($content)
{

{
global $post;

// Compruebo que $post no sea nulo
if ( ! is_a($post, 'WP_Post') ) {
if (!isset($post) || !is_a($post, 'WP_Post')) {
return $content;
}

if ($post->post_type == 'personal') {
if (file_exists(plugin_dir_path(__DIR__) . 'frontend/views/single-personal.php')) {
ob_start();
include(plugin_dir_path(__DIR__) . 'frontend/views/single-personal.php');
$content = ob_get_clean();
return $content;
}
if (!isset($post->post_type) || $post->post_type !== 'personal') {
return $content;
}

return $content;
if (file_exists(plugin_dir_path(__DIR__) . 'frontend/views/single-personal.php')) {
ob_start();
include(plugin_dir_path(__DIR__) . 'frontend/views/single-personal.php');
$content = ob_get_clean();
return $content;
}

return $content;
}
public function get_repositories_wpdspace($value){
$this->repositories= $value;
Expand All @@ -130,9 +129,17 @@ public function list_personal($atts = array())
$content = ob_get_clean();
return $content;
}
public function remove_personal_title( $title, $id ) {
public function remove_personal_title($title, $id)
{
global $post;
if ( is_singular( 'personal' ) and $id == get_the_ID() ) return '';

if (!isset($post) || !is_a($post, 'WP_Post')) {
return $title;
}

if (is_singular('personal') && $id == get_the_ID()) {
return '';
}

return $title;
}
Expand Down