On the following development site, I have a main Products (custom post type) page:
http://keg.brettatkin.com/products/
I want the "Read More" on this page.
When I click through to a specific product, I'm using the Excerpt as the the basic product description and do not want the "Read More" displayed.
http://keg.brettatkin.com/products/creating-compelling-communication/
I have a custom template for the product description pages. How do I remove the "Read More" from this template page?
Thanks
Brett
Look in your functions.php file of your theme, look for a line that starts with.
add_filter('excerpt_more',
It will have 2 arguments and look similar to
add_filter('excerpt_more', 'new_excerpt_more');
the 2nd argument is the function that prints the "read more" so look for the function in this case 'new_excerpt_more' and return ''; after the function declaration.
function new_excerpt_more()
{
if(is_page('excerpts') return "";
// old code here
}
Related
is it possible by any plugin or code modifications to show different contents on frontpage and on "Read more" click. So, could I make a post which looks different on the frontpage and on the article page, so once someone clicks it shows a different post or content.
Have you tried using the_excerpt?
wordpress codex - the_excerpt();
You can also modify the excerpt read more text which defaults to [...] by adding a filter.
/**
* Filter the excerpt "read more" string.
*
* #param string $more "Read more" excerpt string.
* #return string (Maybe) modified "read more" excerpt string.
*/
function wpdocs_excerpt_more( $more ) {
return 'Custom read more text';
}
add_filter( 'excerpt_more', 'wpdocs_excerpt_more' );
The excerpt itself is set within the create/edit post in the admin.
You may need need to show the field in the admin which can be done in the screen options at the top of the create/edit post in the admin.
If you require more freedom than the_excerpt provides, I would suggest using custom meta.
I have some pages with two slugs,
For the first one they have both property,
For the last one it could be status or features .
Something like :
http://www.mywebadress.com/property/status
http://www.mywebadress.com/property/features
I want to display "Text 1" if i'm on the status page and "Text 2" if i'm on the features page. How can i do it ?
I've to use a slug function of wordpress like this code but for slugs ?
Thanks
<?php
if(is_page()){
echo 'Text 1';
} elseif(is_page()){
echo 'Text 2';
} else {
////
}
?>
You should probably just create subpages. This will give you the slug system you want and it will be easier to manage each page individually. The codex has information on how to do this here: https://codex.wordpress.org/Pages#To_create_a_subpage
Currently, by default, the following columns appear in the list of pages in the WordPress admin panel:
Title
Author
Comments
Date
and because I have AIO SEO installed:
SEO Title
SEO Description
SEO Keywords
Is there a way to have WordPress also display the URL to the page (at least the part of the URL that is created when the page itself is created)?
The page url is actually already there by default, it's just hiding. When you hover over a page title, several links appear below the title -- edit, quick edit, trash, view. View is the hyperlink to the page, which you can click to view the page, or right click and copy the link address to use elsewhere.
Otherwise, if you are using a custom/child theme, you could add the following to your functions.php file:
add_filter('manage_page_posts_columns', 'my_custom_column', 10);
add_action('manage_page_posts_custom_column', 'add_my_custom_column', 10, 2);
function my_custom_column($defaults) {
$defaults['url'] = 'URL';
return $defaults;
}
function add_my_custom_column($column_name, $post_id) {
if ($column_name == 'url') {
echo get_permalink( $post_id );
}
}
Note: This just creates a text url to your page.
Also note, you do not want to edit your functions.php file directly if you are using a theme you did not create, as it will be overwritten when you update. If you want to add this to an existing theme, I'd suggest looking into child themes.
This is helpful. I would only improve the output slightly by removing the site url and just showing the page. Takes up less space and less to weed through visually.
if ($column_name == 'url') {
$siteURL=get_site_url($post_id);
$link= get_permalink( $post_id );
echo str_replace($siteURL,"",$link);
}
I'm trying to remove the word "Archive" from the page title.
How to remove it? By adding a filter?
Example:
My collections Archive | My sitename
Best to use Wordpress SEO by Yoast.
Within Titles & Metas go to the Taxonomies tab and update the Title template for Product Categories to remove the word Archive. Mine ended up looking like this:
%%term_title%% %%page%% %%sep%% %%sitename%%
you can rewrite the filter in functions.php so it fails, causing WooCommerce not the render it.
function override_page_title() {
return false;
}
add_filter('woocommerce_show_page_title', 'override_page_title');
If you are using the Yoast SEO (VersiĆ³n 8.1.2), the options were move to:
Yoast SEO -> Search Appearance -> Taxonomies.
In there look up by Product categories (product_cat) and open it.
Then remove the Archives string from the head.
I know this is an old post but I tried the answers here and it didn't work.
I found the solution basing it off renegadesk's answer, but in addition of going to the Taxonomies Tab I also had to change it in the Post Types tab. See below:
Get Wordpress SEO by Yoast if you don't already have it, then click SEO > Titles & Metas > Post Types. Scroll down and look for the heading "Custom Post Type Archives". On the "Products", you can edit the content of this title. Mine now looks like this:
%%pt_plural%% %%page%% %%sep%% %%sitename%%
In woocommerce there seem to be 3 instances of Archives (case sensitive) one in
\wp-content\plugins\woocommerce\woocommerce-hooks.php around line 50
and 2 in \wp-content\plugins\woocommerce\woocommerce-template.php
around lines 240 ish
Perhaps one of those is what you're looking for and you may be able to modify code.
in addition to Ted C:
For this purpose Wordpress has already predifined functions starting with __return_.
In this case the function you are looking for is __return_false.
add_filter('woocommerce_show_page_title', '__return_false',10,0); will also work.
The last two params are the order of the function and the number of params passed to it.
It is always a good pratice to set them up but this is only necessary if you want to modify the default order (10) and the number of params passed (1).
You have this filter for all cases : "get_the_archive_title".
But then there are different cases.
For exemple for simple category you can do :
function prefix_category_title( $title ) {
if(is_category()){
$title = single_cat_title( '', false );
}
return $title;
}
add_filter( 'get_the_archive_title', 'prefix_category_title' );
For custom post type you should do :
function prefix_category_title( $title ) {
if(is_archive('slug-of-your-custom-post-type')){
$title = single_cat_title( '', false );
}
return $title;
}
add_filter( 'get_the_archive_title', 'prefix_category_title' );
So finally you have many condition like :
is_category
is_archive
is_tag
is_author
is_year
is_tax
https://developer.wordpress.org/reference/functions/get_the_archive_title/
Vincent.
wp-content/plugins/woocommerce/templates/archive-product.php
Edit this file archive-product.php and remove the below 3 lines.
<h1 class="page-title"><?php woocommerce_page_title(); ?></h1>
<?php endif; ?>
This will remove page title on shop page and all other pages.
I am having this problem that I have a Plugin which has two sub menus: Escape Submitter and Event Submitter. But the thing is I created the Plugin pages like this:
add_action( 'admin_menu', 'my_plugin_menu' );
function my_plugin_menu() {
add_menu_page('Submission Requests', "Submission Requests", 'add_users',"submission-requests/show.php",'',PRO_URL."/images/icon.png",27);
add_submenu_page( 'submission-requests/show.php', "Escape Submitter", "Escape Submitter", 'manage_options', 'escape_submit','escapeSub' );
add_submenu_page( 'submission-requests/show.php', "Event Submitter", "Event Submitter", 'manage_options', 'event_submit','eventSub' );
}
and it Look like this in Wordpress plugin Page
But the thing is that I don't want to add the main menu page 'Submission Requests' to show in the main menu I just want to see something like this:
How can I do this do I have to call other type of add_menu_page function? Or do I have to give some parameters to the same. Because I want to show Escape Submitter as first Page when a user clicks on my Plugin.
P.S: Sorry for my Bad English i hope you understood the problem and please forget about those Numberings after those Menu Names
You add_menu_page slug and your first add_submenu_page slug need to be the same.
For example:
public function RWSDevBlip_add_admin_menu() {
add_menu_page('Blip.tv Interface','Blip.tv API','manage_options','rwsdev-blip',array($this,'RWSDevBlip_admin_page'),$this->pluginurl.'images/RWSDevBlip.png',3);
add_submenu_page('rwsdev-blip','Blip.tv Interface Options','Settings','manage_options','rwsdev-blip',array($this,'RWSDevBlip_admin_page'));
add_submenu_page('rwsdev-blip','Blip.tv Interface Upload','Upload','manage_options','rwsdev-blip-upload',array($this,'RWSDevBlip_upload_page'));
add_submenu_page('rwsdev-blip','Blip.tv Interface Videos','Videos','manage_options','rwsdev-blip-videos',array($this,'RWSDevBlip_videos_page'));
}
Hope this helps.