Answer the question
In order to leave comments, you need to log in
How to display content using show()?
Hello, please tell me how to implement.
There is a WordPress page, it has its own template.
In this page, you need to display 4 posts of a certain category.
This is understandable. Did
Here I want to do, when you click on the link of the post, below showed the content of this post. without going to the page
Answer the question
In order to leave comments, you need to log in
Well, in general, for good, you need to make an API, and access each post via ajax, and display it.
And so, let each post have a block
in css you do
and the links should be of the form
and if we use jQuery, then we write
$(function() {
$('[data-to-post]').click(function(e) {
e.preventDefault();
var postId = $(this).data('to-post');
$('.post_block').not('[data-post-id="' + postId + '"]').fadeOut(); // прячем все блоки, кроме текущего, чтобы не было бага анимации
$('.post_block[data-post-id="' + postId + '"]').fadeIn(); // показываем нужный
});
});
You hang up the output agent on click on title.
The handler makes an ajax request.
Receives data.
Brings out something down there.
With which of the points of difficulty?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question