Hi Andy,
I was using the code for years now. But after changing the wordpress template.
The code does not show the last new wordpress entries...
It shows links to two pages. But even this links are wrong!?!
Do you have a idea why?
my $prefix = 'wp_';
use DBI;
my $dbh = DBI->connect('DBI:mysql:xxxxxxxx', 'xxxxxxxx', 'xxxxxxxx'
) || die "Could not connect to database: $DBI::errstr";
my $query = qq|SELECT * FROM ${prefix}posts WHERE post_parent < 1 AND post_status = 'publish' ORDER BY ID DESC LIMIT 3|;
my $sth = $dbh->prepare($query) || die $DBI::errstr;
$sth->execute() || die $DBI::errstr;
my @loop;
while (my $hit = $sth->fetchrow_hashref) {
push @loop, $hit;
}
$sth->finish();
$dbh->disconnect();
return { blog_loop => \@loop }
}
Thanks
Matthias
gpaed.de
I was using the code for years now. But after changing the wordpress template.
The code does not show the last new wordpress entries...
It shows links to two pages. But even this links are wrong!?!
Do you have a idea why?
Code:
sub { my $prefix = 'wp_';
use DBI;
my $dbh = DBI->connect('DBI:mysql:xxxxxxxx', 'xxxxxxxx', 'xxxxxxxx'
) || die "Could not connect to database: $DBI::errstr";
my $query = qq|SELECT * FROM ${prefix}posts WHERE post_parent < 1 AND post_status = 'publish' ORDER BY ID DESC LIMIT 3|;
my $sth = $dbh->prepare($query) || die $DBI::errstr;
$sth->execute() || die $DBI::errstr;
my @loop;
while (my $hit = $sth->fetchrow_hashref) {
push @loop, $hit;
}
$sth->finish();
$dbh->disconnect();
return { blog_loop => \@loop }
}
Thanks
Matthias
gpaed.de