Archived topic
Queries on Blog and widget link
34 replies · Started by Janani on October 22, 2022
Dear Team
I am almost completing my website. I have few questions that I would need your help with -
1. I had created an element which was a jquery which opened my posts in a new page when I clicked on the post title from the blog page. Now, I have decided to change the design, so that the posts will open the normal way when clicked on from the blog page, rather than in a new page. Will I achieve this by simply deleting the element that I had created previously? Or do I need to modify the code in the element? The code is as follows given by your team earlier -
<script>
jQuery(document).ready(function($){
$('.entry-title a').attr('target', '_blank');
});
</script>
2. I have created categories for my posts. Is it possible to give category links that would open up all the articles within that specific category in the blog page? How do I do that?
3. In the Blog page, you can see that there are large gaps between the post titles. How can I reduce this gap and make it look more reasonable?
4. I have a sign up form in my footer widget. How do I give a link that would lead to this sign up form from another page?
Kind regards
Janani
Hi there,
Let's handle one question per topic as suggested in our forum guidelines here:
https://www.screencast.com/t/t4Y3VgrhIP
Will I achieve this by simply deleting the element that I had created previously? Or do I need to modify the code in the element?
I believe removing the code would work - have you tried setting the element to Draft to test?
Dear Leo
Apologies, missed to see the instructions. Yes, the first query is resolved, thanks to your excellent support. Could you please help to resolve my another query as well?
I have a sign up form in my footer widget. How do I give a link that would lead to this sign up form from another page?
Kind regards
Janani
Hi there,
in your forms HTML you have this opening <div>:
<div class="devshishu-subscriber-form">
Give it a unique ID eg.
<div id="devshishu-subscribe" class="devshishu-subscriber-form">
You can then use the #devshishu-subscribe anchor link in your URL
eg.
https://your-domain.com/#devshishu-subscribe
Dear David
Thank you very much, this worked perfectly!
Could you pls help to answer my other query -
In the Blog page, you can see that there are large gaps between the post titles. How can I reduce this gap and make it look more reasonable?
Try adding this CSS:
:is(.blog, .archive) .inside-article > :is(.entry-meta, .entry-summary ) {
display: none;
}
Dear David
Thank you, but tried adding this code and it did not work. Is there something wrong I am doing?
Where did you add the CSS?
Was it in the customizer > additional CSS? IF so move it to the top of the CSS.
Dear David
Thank you, this finally worked. I am grateful for your excellent support.
Could you help in my last query before I close?
I have created categories for my posts. Is it possible to give category links that would open up all the articles within that specific category in the blog page? How do I do that? I want these category links to come at the top of the blog page above the articles. Is it possible to do that?
If you're not using the Block editor, then you can create a shortcode to display the category list.
See this topic for the PHP Snippet:
Then you can use a Hook Element ( i assume you used one for adding the search bar ) and hook in your new shortcode.
Dear David
Thank you for your support, but it did not quite help me as I am a novice in website building. So could you kindly give me the step-by-step procedure for me to do it myself? For your information, I tried both the methods provided in the URL link which you gave me, but both did not work. Maybe because I did some fundamental mistakes in placing the codes - am not sure where to place what. Please help.
Hi Janani,
To clarify first, are you using the current Block editor or the Classic editor? We'll try to provide a step-by-step approach afterwards.
Sure Fernando, I use the classic editor, but mainly I used sections for building my website, so I am very comfortable with that. I also have code snippets plugin enabled for inserting any codes. I also know to use elements and hooks. So, these are the tools I generally use. Kindly now provide me the step-by-step process of how I can enable category-wise search in my blog archives page.
OK:
1. In Code Snippets, add New Snippet and paste in this code:
function getCategoryList() {
ob_start();
echo"<ul>";
wp_list_categories('orderby=name&show_count=1&title_li=');
echo"</ul>";
return ob_get_clean();
}
add_shortcode('mycatelist', 'getCategoryList');
2. You can then add this shortcode [mycatelist] to any page on your site and it will display your list of categories.
See if that works, we can then discuss how to add it your Blog and how to style it.
Dear David
Thank you very much. It worked!
Now tell me how to add this to the Blog page with a similar style as in this web page.
https://www.tarabrach.com/guided-meditations/
Although these are videos in this linked page, how can I bring in such a category list in my blog with the same styling and design?