I had an earlier Fatal error, and I tried to increase the Memory Limit to 128M in Default-Constants.php
After that error has gone, now this one. I can’t even go to login to the dashboard.
]]><?php while (have_posts()) : the_post(); ?>
in which to place your suggested code after ( <?php if(function_exists('the_ratings')) { the_ratings(); } ?>
).
I have looked at two sites I have access to. One uses Genesis in which the parent theme has an index.php. And I have looked in the index.php of another site using Canvas.
I was wondering if you could throw me a bone here?
Thank you
T
I am working on someone else’s WordPress Installation. They have lot of custom class/lib files added under theme (I am guessing, they might have some custom system where they can develop websites for WordPress). All of their work looks custom. I am still in kind of beginner level and not able to understand how everything works.
Issue: I am not able to attach featured image on any blog post. (Even on custom post type)
Already tried:
Disabled all plugins – Still not working
Change theme to Default – It worked
I have deadline to develop this blog post and don’t know how to solve this.
Thanks in advance.
../theme/class/libs/Post.php file
namespace lib;
class Posts {
function __construct() {
}
public function create_posts($o = []) {
// instantiate classes
$metaBoxesClass = new \lib\MetaBoxes();
foreach($o['posts'] as $post) {
// define post type
$postType = (isset($post['post_type'])) ? $post['post_type'] : 'page';
// construct post
$postArray = [
'post_type' => $postType,
'slug' => $post['slug'],
'name' => $post['name'],
'content' => 'This is the content for the '.$post['name'].' page.'
];
if($o['is_sub_post'] && $o['parent_post']) {
// define parent post
$parentPost = get_page_by_path($o['parent_post'], OBJECT, $postType);
// add child post array items
$postArray['path'] = $o['parent_post'].'/'.$post['slug'];
$postArray['parent'] = $parentPost->ID;
}
// insert top level post
$postID = $this->create_post($postArray);
// update meta boxes
$metaBoxesClass->update_meta_boxes($post);
// if post was made taxonomies were included
if($postID && isset($post['taxonomies'])) {
// for each taxonomy
foreach($post['taxonomies'] as $taxonomy => $terms) {
// add terms to post
$termIDs = wp_set_object_terms($postID, $terms, $taxonomy);
}
}
// if post has sub posts
if(isset($post['sub_posts'])) {
// run function recursively
$this->create_posts([
'posts' => $post['sub_posts'],
'is_sub_post' => true,
'parent_post' => (isset($o['parent_post'])) ? $o['parent_post'].'/'.$post['slug'] : $post['slug']
]);
}
}
return true;
}
public function create_post($postArray = []) {
// if path, use path as full page slug, otherwise just use the slug itself
$slug = (isset($postArray['path'])) ? $postArray['path'] : $postArray['slug'];
// if post doesn't already exist
if(!get_page_by_path($slug, OBJECT, $postArray['post_type'])) {
// construct post
$newPost = [
'post_type' => $postArray['post_type'],
'post_name' => $postArray['slug'],
'post_title' => $postArray['name'],
'post_content' => $postArray['content'],
'post_status' => 'publish',
'post_parent' => ($postArray['parent']) ? $postArray['parent'] : null,
];
// create post
$postID = wp_insert_post($newPost);
return $postID;
}
}
}
Here is the file structure under that Class folder. I am not sure if that helps or not.
* If I place a duplicate into /child/ it is not registered.
* If I place a duplicate into /child/inc/ it is not registered.
* If I place a duplicate into /child/inc/structure it is not registered.
What’s the magic sauce? Thanks.
]]>posts.php
but can I utilise the “Adding your custom profile templates” structure to keep changes on updates?
https://www.ads-software.com/plugins/ultimate-member/
]]>