Welcome Guest, Not a member yet? Register   Sign In
Wordpress integration
#7

(02-09-2018, 03:30 PM)gabrielcastillo Wrote: One thing you can try is using the WordPress REST API. This allows you get WordPress REST API data objects that can be interfaced with other applications.

So, you can pull your homepage data via WordPress REST API and display on your codeigniter home page.. You can also do this with other Pagea as well..

When loading your view pass the WP JSON object and render inside your codeigniter view page.


Here is a link to the WordPress REST API

That's kind of an awkward way to get data, when you have full access to the database. Why not just use CI to query the WP database directly? I do it all the time. Example method:

PHP Code:
/**
 * Get all posts.
 *
 * No revisions or drafts are allowed
 *
 * You have to join the posts table with the term relationships table
 * in order to get the term taxonomy ID. Then you have to join the 
 * terms table because the term taxonomy ID is the term ID, which gives
 * you the slug and category name for the post.
 */
public function get_all$selections NULL )
{
    if( empty( 
$selections ) )
    {
        
$selections '*';
    }

    
$query $this->db->select$selections )
        ->
from$this->table_prefix '_posts p' )
        ->
join$this->table_prefix '_term_relationships tr''p.id = tr.object_id''left' )
        ->
join$this->table_prefix '_terms t''tr.term_taxonomy_id = t.term_id''left' )
        ->
where'p.post_type''post' )
        ->
where'p.post_status''publish' )
        ->
order_by'post_date''desc' )
        ->
get();

    if( 
$query->num_rows() > )
    {
        return 
$query->result();
    }

    return 
FALSE;

Reply


Messages In This Thread
Wordpress integration - by Luca4k4 - 02-05-2018, 08:15 AM
RE: Wordpress integration - by skunkbad - 02-05-2018, 03:04 PM
RE: Wordpress integration - by Luca4k4 - 02-05-2018, 03:56 PM
RE: Wordpress integration - by skunkbad - 02-05-2018, 05:37 PM
RE: Wordpress integration - by Luca4k4 - 02-06-2018, 06:44 PM
RE: Wordpress integration - by gabrielcastillo - 02-09-2018, 03:30 PM
RE: Wordpress integration - by skunkbad - 02-09-2018, 06:04 PM
RE: Wordpress integration - by gabrielcastillo - 02-09-2018, 06:15 PM
RE: Wordpress integration - by antonioalcala - 03-01-2018, 03:55 PM
RE: Wordpress integration - by botikol123 - 05-19-2021, 05:30 PM



Theme © iAndrew 2016 - Forum software by © MyBB