Ask your WordPress questions! Pay money and get answers fast! (more info)

Change "Recent Posts" wording in error page WordPress

Wp version: 3.4.2
theme: twentyeleven

How can i change wording of "Recent Posts" that display in error page?

This is the page:


Answers (1)


Dbranes answers:

Hi do you have a 404.php file in your current theme directory?

I guess you could change it there.

Dbranes comments:

it looks like you are using widgets there, have you checked your widget setup?

maryhellen comments:

In 404.php there is not and is not possible to change it directly in the widget section.

Dbranes comments:

the code look like this:

<div class="widget widget_recent_entries">
<h2 class="widgettitle">Recent Posts</h2>
<li> ...cut ...</li>

so it's hinting towards the widgets.

Can you post the code in your 404.php file?

Looks like you are using a modified version of the theme twentyeleven, so in 404.php there should be a code like this:

<?php the_widget( 'WP_Widget_Recent_Posts', array( 'number' => 10 ), array( 'widget_id' => '404' ) ); ?>

is that correct?

Dbranes comments:

you could then replace this line

<?php the_widget( 'WP_Widget_Recent_Posts', array( 'number' => 10 ), array( 'widget_id' => '404' ) ); ?>

with this:

<?php the_widget( 'WP_Widget_Recent_Posts', array( 'title'=> 'My new title', 'number' => 10 ), array( 'widget_id' => '404' ) ); ?>

where you can replace 'My new title' with your own title.

maryhellen comments:

It works! Thanks. Can ask an other question about this other line of code in 404.php?

the_widget( 'WP_Widget_Archives', array('count' => 0 , 'dropdown' => 1 ), array( 'after_title' => '</h2>'.$archive_content ) );

What if i'd like make an h4 instead of h2 both "Recents Post" and "Archives"?

Tell me if i have to pay for this question.


Dbranes comments:

ok great

you can use this to change h2 to h4

<?php the_widget( 'WP_Widget_Recent_Posts', array('title'=> 'My new title', 'number' => 10 ),array( 'widget_id' => '404','before_title'=>'<h4 class="someclass">','after_title'=>'</h4>' ) ); ?>

for the "Recent post" widget

Dbranes comments:

and this for the "Archive" widget:

/* translators: %1$s: smilie */
$archive_content = '<p>' . sprintf( __( 'Try looking in the monthly archives. %1$s', 'twentyeleven' ), convert_smilies( ':)' ) ) . '</p>';
the_widget( 'WP_Widget_Archives', array( 'count' => 0 , 'dropdown' => 1 ), array('before_title'=>'<h4 class="someclass">','after_title' => '</h4>'.$archive_content ) );

maryhellen comments:

In the meanwhile I resolved my second question. Thanks

Dbranes comments:


(please vote if you are satisfied with the answer ;-)