I have php code which generates readmore link. I need to add css style="border-bottom: 1px solid #000000;padding:20px;"
but don't know how. Any help with that:
if ( preg_match("/GN_readmore/", $html) && $link ) {
$gn_readmore = JHTML::_('link', $link, JText::_('MOD_GLOBALNEWS_READ_MORE_TITLE'));
}
Can you copy/paste the html output code? We may find an attribute to style. It's what #04FS is describing.
Example:
If "read more" is a title attribute, you can style it using the CSS2 [attribute~=value] selector where your attribute is "title" and the value is "read more". Be sure the title is exactly how it's shown in your html.
https://www.w3schools.com/cssref/sel_attribute_value_contains.asp
Sometimes you only want to style the "read more" on one page without affecting all pages. So, assign a css name to the page through the menu manager (on that menu item). If it's not a menu item on your primary navbar, then create a new (hidden) menu. A hidden men is very handy because you can have internal links with the flexibility to change that menu item another time; it then updates all internal links throughout the site like your main menu does.
Related
I'm trying to show that one of the categories is on sale by displaying "ON SALE! -50%" text in category list widget.
I obviously can't and won't modify category name to include this text.
Here's the website: https://demo.wpdesk.org/michalkleszko23gmailcom/
Maybe the fastest way how to do it is to write a short javascript, which will edit text. So, if yours widget has id="block-5" (according to the demo), you just add replacing script into the next custom HTML widget under the yours category widget.
<script>
document.getElementById('block-5').innerHTML = document.getElementById('block-5').innerHTML.replace("Albums", "Albums <div style=\"color:red\">ON SALE! -50%</div>");
</script>
I have created a one page Wordpress website with jump links to various sections however the Contact section is a widget and doesn't have a nice looking human readable id attribute (id="wpforms-widget-3") meaning when the link is clicked on, it won't be clear from the URL that it's the contact section e.g. currently looks like www.example.com/#wpforms-widget-3 instead of www.example.com/#contact
How can I change the output of the widgets to include the widget title as an h2 id attribute?
Currently, the contact widget looks like <h2 class="widget-title">Contact</h2>
It needs to be: <h2 id="Contact" class="widget-title">Contact</h2>
Google is not my friend tonight and while I can find things like how to add additional HTML tags and sections or change h2 to hx, I can't find anything for getting the widget title and adding it to the existing h2 tag as an id.
Closest I have found so far is:
function add_widget_name_id($params) {
$params[0]['before_title'] = '<h2 id="' . $params[0]['widget_name'] . '" class="widget-title">' ;
return $params;
}
add_filter('dynamic_sidebar_params', 'add_widget_name_id');
From: https://stackoverflow.com/a/6080097/5204226
Unfortunately, this doesn't seem to do anything and the h2 tag still only contains class and not the needed id.
Thanks in advance!
I use a product category description in every products category in woocommerce, but i don't know how to show the full description. After a few words it just stops and shows "..."
https://i.stack.imgur.com/BaOx5.jpg
There are 2 general ways I'm aware the text would show ... at the end. Either via code or by CSS text-overflow: ellipsis; If it's using the CSS method, then you got to inspect the element (try right-click on element and choose Inspect, or something similar to that), see which html tag has the style set and then remove it or override it in the stylesheet.
(BTW: If you notice that the full description is there when inspecting the element, then text-overflow CSS is most likely involved.)
Read more here: https://developer.mozilla.org/en-US/docs/Web/CSS/text-overflow
If it's not CSS but done by code, then it's necessary to get more details on the code used for this to know how to change it. It can be done either by JavaScript or PHP and might be dependent on the WordPress Theme in use.
A quick solution is to observer the source code for the page. See if the full text is in use anywhere else on the page, and then use JavaScript to rewrite the text in the Description area based on it. Read more http://api.jquery.com/html/
Otherwise, you will have to find out if there are any API Hooks that can intercept the Description area to change the text. (Maybe https://codex.wordpress.org/Function_Reference/category_description or http://hookr.io/actions/woocommerce_archive_description/)
Again it might be dependent on the theme. If you are not getting through, add the Theme name to your question, to try get more help.
Here's an example of how to use woocommerce_archive_description
add_action( 'woocommerce_archive_description', 'woo_category_description' );
function woo_category_description() {
if ( is_product_category() ) {
global $wp_query;
$cat_id = $wp_query->get_queried_object_id();
$cat_desc = term_description( $cat_id, 'product_cat' );
$description = '<div class="description">'.$cat_desc.'</div>';
echo $description;
}
}
I would like to know how I can modify the menu title within the template.php of the theme I am using.
So far, I have been able to modify both the UL and LI elements by using hooks: THEME-NAME_menu_tree__MENU-NAME and THEME-NAME_menu_link__MENU-NAME respectively. However, I cannot access the menu title form either of those (or at least that's what I think). I have tried to use the THEME-NAME_menu__MENU-NAME hook, but it seems that the function is simply being ignored.
Thank you for your time.
Your menu is generated within a block. You should be able to change the subject / title by preprocessing the block. For example, change all subjects of blocks and wrap a <span> around it.
function MYTHEME_preprocess_block(&$variables) {
$block = $variables['block'];
$block->subject = sprintf('<span>%s</span>', $block->subject);
}
I am creating a menu for an Indian restaurant, The Curry Lounge. I want to show the vegetarian symbol next to the title (as shown) if it is actually a vegetarian dish.
I have tried to look for a way to do this in custom fields but have had no luck in doing so. I have created a custom field within one of my posts and called it "hass_veg" and in the menu_page_template of my theme I have the following code where I want it to be placed:
<?php if ( $hass_veg <> 'Y' ) { ?>
<img src="http://www.tesco.com/wine/UIAssets/I/Sites/Retail/Wine/Online/Product/IsVegetarian.gif" alt="Vegetarian" height="30" width="30">
<?php } ?>
I have deduced that when I put the "Y" in, the image appears on the page.
Can anyone help me at all?
In your stylesheet:
.cufon-canvas{
background: url('path_to_your_image_goes_here');
}
Or whatever class name you choose to give the div next to the vegetarian items. I'd add the image in the stylesheet so you (and others) don't have to dig through the php to change it.