NateWr / business-profile

WordPress plugin to display your business's contact details with seo-friendly Schema.org markup.
34 stars 16 forks source link

Backend translation fix #65

Closed lucspe closed 7 years ago

lucspe commented 7 years ago

Backend translation was not being applied (WP 4.7.2, theme Storefront) unless I changed the hook for load_textdomain to plugins_loaded)

NateWr commented 7 years ago

Hi @lucspe,

Thanks for the PR! Would you mind issuing a PR with just the load_textdomain fix and the Italian translation?

I get requests for a fax number occasionally, but just not enough to add it to the core plugin. I'd be happy to help show you how to add the fax number and the additional opening hours info into a separate plugin that seamlessly integrates the additional fields.

lucspe commented 7 years ago

Hi,

Sorry for late reply.

1) Sure I don't mind. These should have been really separate pull requests. What would be the best way to proceed to do that? (I am not uber-familiar with github)

2) As for fax number and additional opening hours info, my understanding is that if I use the "bpfwp_settings_page" filter, these will be displayed at the very bottom, or am I missing something?

NateWr commented 7 years ago
  1. Are you using git on the command line? If so, you can roll back your two recent commits with the following:
git reset HEAD~2
git push --force

(Keep in mind that will remove your existing commits so they'll disappear. Make sure you save your italian translation so you can commit it again, and save your fax and additional info work for your plugin.)

  1. The $section->add_setting() method accepts a position argument. So if you wanted to place the fax number below the phone number, you could do the following:
$sap->add_setting(
  ...
  array(
    'id' => 'fax',
    ...
    'position' => array('below', 'phone')
  )
);

You can see the code which processes position values here:

https://github.com/NateWr/simple-admin-pages/blob/master/classes/AdminPageSection.class.php#L71-L102

lucspe commented 7 years ago

Ok, working on this.

How could then I indicate where to print it on front-end? So far it shows in the right place in the backend but still it prints at the end in the frontend.

lucspe commented 7 years ago

Ok, I think I found the answer myself, but just to be sure I am doing it right, I basically use the "bpwfwp_component_callbacks" filter to rewrite the $callbacks array instead of simply adding the fax to it.

NateWr commented 7 years ago

@lucspe Yep, that's it! Sorry for the delay. I didn't touch work over the weekend. :)