More tag prevents MetroPress to display the entire content of my posts

Jan 15, 2013 at 4:46 AM
Edited Jan 15, 2013 at 4:58 AM

Hi,

I'm just discovering and testing this awesome project. After my first tests, I have this problem : all my WordPress posts that have a manual "more" tag are cut in MetroPress. Is there a way to tell MetroPress to not take account of the "more" tag and let it display the entire content of the post ?

 

Moreover, how can I filter the number of "Recent posts" ? Because when I click on "Recent News" it have more than 50 posts and I'd just like to have the 10 recent posts for instance for each category.

 

If you need help, beta testing or french translation, do not hesitate to ask me !

Developer
Jan 24, 2013 at 9:50 PM

Hi tulipwork,

Try the following:

At wpapi.js, line 852

        else if (self.id == MOSTRECENT)
            query_string = '?json=get_recent_posts&count=' + WPApi.getDefaultPostCount() + "&page=" + (page + 1);

 

The above line is saying, get me recent post, and with total number of WPApi.getDefaultPostCount().

Change WPApi.getDefaultPostCount() to 10, and  you will end up with 10 post..

 

I haven't test the above code myself, but give it a try

Jan 31, 2013 at 5:34 PM
Hi Michael,

Thank you for your reply! Unfortunately, your solution didn't work.

Let me know if you have another idea. In all cases, thank you for your awesome work.
Developer
Jan 31, 2013 at 6:11 PM
Hi tulipwork,

I just tried using the above code, it should be working.

Did you change your localStgorageSchemaVersion to prevent Metropress to get data from localStorage?
Jan 31, 2013 at 6:25 PM
Thousand apologies, you're right! I've been mistaked by the number of posts next to "Recent news" title which displays "56", do you know a way to remove it or to display "10" for instance ?

By the way, do you know a way to fix the issue I have related to the "read more" tag ?

If these two points are OK I plan to use MetroPress for a french magazine, and I'd like to mention your project on our credit page.
Developer
Jan 31, 2013 at 6:44 PM
Hi tulipwork,
  1. For Recent news, it is showing the total number of post by the category. To change that, you have to go to around line 886,
   else {
                    self.category.post_count = data.count_total;
                    self.post_count = data.count_total;
                }
and change that to
   else {
       if(self.id == MOSTRECENT){
                    //custom code
                    self.category.post_count = data.count;
                    self.post_count = data.count;
       }else{
                    self.category.post_count = data.count_total;
                    self.post_count = data.count_total;
        }  
    }
Under custom code, it says that assign the total number of post it retrieve instead of total number of post that recent news has. This solution might not be the best, but I think it solves your request.

For your "read more" tag, I am no sure what you are referring to...
Developer
Jan 31, 2013 at 6:46 PM
Edited Jan 31, 2013 at 6:47 PM
Hi tulipwork,

For your "more" tag, can you provide a screenshot?

and it will be good if you mention MetroPress on your next coming product. Thank you for using MetroPress.

Michael Siu
Jan 31, 2013 at 6:54 PM
Yes, sorry, here is screenshots of what I mean:

1) http://bit.ly/W2AdEB

2) http://bit.ly/TgQ7ge

Thank you very much for your tip concerning the number of recent posts!
Jan 31, 2013 at 7:11 PM
I applied the changes for the Recent news and it's always showing "56 posts" rather than "10", is it normal ? If I remove the code, it still show "56"... Do you have an idea?

By the way, is it normal that recent posts aren't ranged by date ? I mean that the last post isn't showing on the top left.
Developer
Jan 31, 2013 at 7:29 PM
Hi tulipwork,

Did you change your localStorageSchemaVersion to a higher number? If you did, can you put a breakpoint to see if it's hitting inside your MOSTRECENT if statement and make sure that data.count is 10?

For the order of recent post, it is in a reverse order rightnow, and it is in our bug list, I will look for a temporary solution for you.

Also, for your screenshots, I need to get back to you on this one.
Jan 31, 2013 at 7:46 PM
Hi,

I don't think I changed the localStorageSchemaVersion because I didn't understand what does it mean. I saw this on your Quick Start Guide but I skipped this step because I didn't understand it.

Here is the code related to the localStorageSchemaVersion in WPapi.js :
var WPApi = {
    localStorageSchemaVersion: '20121125-1',

    categories: [],
    fetching: false,
    bookmarks: null,
    list: new WinJS.Binding.List(),
    groupedList: null,
    postsFetched: null,
    pagesFetched: null,
    refreshFetch: false,
For the order of recent posts, no problem, don't take time for finding a temporary solution, I can wait your future release!

I'll wait your feedback concerning the "more" tag.

Thank you for taking in your time to help me.
Developer
Jan 31, 2013 at 7:55 PM
change localStorageSchemaVersion: '20121125-1', to localStorageSchemaVersion: '20121125-2',

MetroPress will cache your data in localstorage, the above code will the MetroPress that you are using a different version and retrieve all the data again from the web instead of local storage.
Jan 31, 2013 at 8:20 PM
OK I just unterstood the logic! I made it and it runs well now. Thank you very much!
Feb 4, 2013 at 11:14 PM
Hi Michael,

I hope you are fine. Just want to know if you found a solution related to the more tag issue ?

I can't wait to launch my app ;)
Developer
Feb 7, 2013 at 3:33 AM
Hi Tulipwork,

Unfortunely, can you send me the website you are connecting to that installed json API, i want to see the returned data.

My email is michael.siu@ideanotion.net.
Feb 17, 2013 at 2:58 PM
Hi Michael,

Yes of course, I sent you admin access to the concerned website.

Regards