SITUATION:
I currently load the latest posts chronologically with this code:
CODE:
$scope.data = [];
var _n = Math.ceil(($(window).height() - 50) / (350)) + 1;
var _start = <%= lastID %>;
var firstElementsLoaded = false;
$scope.getDataset = function() {
fb.orderByChild('id').startAt(_start).limitToFirst(_n).on("child_added", function(dataSnapshot) {
_start = dataSnapshot.child("id").val() + 1;
console.log("LAST TRUE ID:"+ _start);
$scope.data.push(dataSnapshot.val());
$scope.$apply()
console.log("THE VALUE:"+$scope.data);
firstElementsLoaded = true;
});
};
$scope.getDataset();
QUESTION:
How should I modify it to essentially have the exact same behaviour but to only query posts with scores above 100 according to their chronological order ?
UPDATE:
I have finally found a way to use the "create another index" method with my architecture. But one hurdle remains:
How to copy a childNode from one node to another?
A good SEO score is between 80 – 100. SEO scores in this range indicate that your website is meeting the top quality standards for search engine optimization in the areas of technical SEO, content, user experience, and mobile usability.
By default, the block shows 5 posts, but you can display anywhere between 1 and 100 posts. You also have the option to display your recent posts in a column grid rather than a list. You can customize the grid to featured images for your posts, resize the image, and align them accordingly:
Use WordPress’s Latest Posts Gutenberg Block The WordPress block (Gutenberg) editor has a built-in block for displaying your latest posts. You can easily add this to any of the posts or pages on your site. To use this block, simply edit the post where you to display recent posts.
You can easily add this to any of the posts or pages on your site. To use this block, simply edit the post where you to display recent posts. On the post edit screen, you need to add the ‘Latest Posts’ block to the content area. There are lots of different ways you can configure this block.
You can also load the rest of the posts automatically on scroll instead of having to click on a button. This can be achieved by making it invisible by setting the visibility to hidden. The following code will run the load_posts () function when you’re 100px from the bottom of the page.
I rethought my architecture and created a specific index for top posts:
if (funPost.score >= global.hotNumber && funPost.hot == false) {
var hotPostRef = firebase.database().ref("hot/section/"+key);
var hotPost = {
title: funPost.title,
image: funPost.image,
id: funPost.id,
key: funPost.key
}
hotPostRef.set(hotPost);
funPostRef.update({"hot": true});
}
else if (funPost.score <= (global.hotNumber - 25) && funPost.hot == true) {
var hotPostRef = firebase.database().ref("hot/section/"+key);
hotPostRef.remove();
funPostRef.update({"hot": false});
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With