Variable in feed url in mailchimp - rss

Using mailchimp to send RSS-driven campaigns. Fetching the RSS from a WP installation. This works fine.
In the end of the email I want to add one RSS-item from another source with mailchimps merge tag *|FEED|* as shown in this tutorial: http://kb.mailchimp.com/article/how-can-i-add-any-blog-post-to-a-regular-campaign
I got this to work with a static URL. But I want to use different URL:s depending on the recipient. I've saved the URL:s with mailchimps API in a merge tag called *|USER_FEED_URL|* and I can print this URL perfectly, but is there a way to use the feed tag with my user_feed_url and fetch the RSS?
Tried: *|FEED:*|USER_FEED_URL|*|*
But it only print: *|FEED:http://theuserurl.com/feed|*

Related

Can't get featured image with WordPress REST API

I'm using WordPress REST API and can receive data from https://websitename.com/wp-json/wp/v2/posts?_fields=author,id,excerpt,title,link,featured_media_src_url.
The problem is featured_media_src_url is added with This WordPress Plugin and I can't retrieve it using URL filters. (it works by fetching just .../w/v2/posts without params)
It looks like the plugin gets the path using featured_media which returns an id. Adding this to the fields solves the problem:
https://websitename.com/wp-json/wp/v2/posts?_fields=author,id,excerpt,title,link,featured_media_src_url,featured_media

Firebase Dynamic Links with parameters

I have a custom domain setup with Firebase Dynamic Links. The URL prefix is https://example.com/link and I am then able to create a new dynamic link that will resolve https://example.com/link/article to https://example.com/article within my app or on the website.
What I need to do is also pass the ID of the article that I want people to see. The copy writers need a URL structure that lets them cross-link articles, so it needs to be a URL like this: https://example.com/link/article?id=123456 but when I test this in the browser it resolves to https://example.com/article .. this should be possible right? I shouldn't have to create a dynamic link for every single piece of content should I? Would I need to add https://example.com/link/article/123456 so it links to that specific article?
If I were to create Dynamic Links using the REST API in a Cloud Function that is triggered when new content is added to the Firestore, would these links persist?
I know that using the long Dynamic Link format will give me what I need, as I can create the short URL with the param added. But this doesn't solve the issue of giving the Copy Writers a URL structure that is easy to use in their content. Maybe a Cloud Function that strips out the URL links from the body copy, and replaces it with the long-form Dynamic Link?

WooCommerce REST API - Get Custom Fields for Order

I'm using the WooCommerce REST API (http://woocommerce.github.io/woocommerce-rest-api-docs/#introduction) and are able to download Customers, Orders etc successfully.
My customer has added some custom fields to the checkout page, e.g.:
po_number
accounts_email
I would like to be able to GET these custom fields when requesting an ORDER, e.g.:
/wp-json/wc/v1/orders/4568
At the moment none of the custom fields are returned when I GET an Order. I've tried adding
?filter[meta]=true
to the request URL but that doesn't make any difference. Is there a way I can modify the GET URL to include all custom fields? Couldn't find any reference in the REST API docs to custom fields.
I have struggled like you did, but then it turns out using the newer v2 REST API solves the issue for me. So instead of:
/wp-json/wc/v1/orders/4568
I now use:
/wp-json/wc/v2/orders/4568
And custom fields will be included in the response with the key meta_data, even with those hidden fields starting with _.

Create custom wordpress url to query data from external database

so, I have a Wordpress Setup with a custom homepage template. In the template I query some products from an external database. Now I want to create a detail of a product, and this is where im stuck..
I don't know how to implement this since there is no data in the WP db thus no actual url (I guess?).. I thought about making 1 page in WP called 'Detail' and make the href attribute on the homepage products like this 'www.example.com/detail/123', get the id from the url en with that id query to the database..
Is this the right approach? Hope someone can help..
thanks!
If i understand you right, you want to query content from one wordpress website to another right ?
The right way to do it is to use JSON APIs which will let u retrieve the content you need using HTTP requests.
You can set these APIs yourself, refer to the following tutorial.
Thus, you can also use this wonderful wordpress plugin :
JSON API
After installing and enabling the plugin you'll have to set your API links according to the content you need to get, for example the following api:
http://example.com/api/get_posts/?post_type=custom_post_type&count=3
queries the latest 3 custom posts along with their fields and custom fields (if present).
Find more examples here.
Now on your other website where you want to display the content you 'll need to use JSON decode to convert the JSON string into a PHP obect or array.
For example:
$json = '{"a":hello,"b":hi,"c":hey,"d":yo,"e":ola}';
$data = json_decode($json);
echo $data->{'a'}
// this should echo the value "hello"
As stated here.
I hope that helps !
I don't think he wants to query another WordPress. He only says that he fetches data from another database that contains products.
Your idea is pretty close to what you have to do. Take a look at add_rewrite_rule, add_rewrite_tag and get_query_var.
This tuts is a good example for you: http://code.tutsplus.com/articles/custom-page-template-page-based-on-url-rewrite--wp-30564

Escape a Shebang /#!/ in URL for Google URL Builder

Does anyone know if/how I can escape the shebang or encode the uri to make a link work properly in google analytics url builder? I want to add campaign parameters to product page urls to track ads success. The url for each individual product page looks like this:
http://www.oursite.com/classic-movies/#!/Title-of-Movie/p/12345678
When I put the product page url into the url builder, it says the url is invalid. I think it is because of the #!. I have tried escaping out the special characters, replacing the shebang with %23%21 or %21!
It appears valid in the url builder, and the builder generates a link with utm tags, BUT when you paste the tagged link into the browser, it does not take you to our product page. It takes you to our website, but gives a "sorry does not exist" message.
I also tried this:
http://www.oursite.com/classic-movies/?_escaped_fragment_=/Title-of-Movie/p/12345678
It generates a link in the builder and does link to the product page of our website (yay!), but the url adds this after the campaign name: #!/Title-of-Movie/p/1234567
The shebang is back! Will that be a problem?
For reference, we're using the Ecwid storefront plugin for a wordpress site.
Thanks in advance.
Short answer
You should use the URL without fragment (hash part) as a base for building URLs with queries (the part starting with '?') and then append the hash part to the end of URL.
Example:
1) Take http://www.example.com/classic-movies/#!/Title-of-Movie/p/12345678
2) Remove hash part: http://www.example.com/classic-movies/
3) Use this hash-free URL as a base and add query parameters yourself or use any automatic builder. Example: http://www.example.com/classic-movies/?utm_source=myblog&utm_campaign=xyz&abc=def
4) Append the hash part to the end of the URL: http://www.example.com/classic-movies/?utm_source=myblog&utm_campaign=xyz&abc=def#!/Title-of-Movie/p/12345678
You're done – the final URL is valid URL which will work fine for browser/customer, your site server and tracking tools like Google Analytics
Long answer
1) URLs could be very different, but their structure is actually quite the same and that's a part of the web standards.
URL is built this way:
protocol://site/path?query#fragment
(I simplified it and take in consideration only the parts we're talking about, the actual scheme is a bit more complicated)
Taking your product page URL, that will be:
protocol: http
site: www.example.com
path: classic-movies/
query: (empty)
fragment: !/Title-of-Movie/p/12345678
Now, if you want to add query parameters, you know where to insert them. As to the fragment part, it should be always in the end, regardless of whether it contains !
2) Google Analytics doesn't track the fragment parts of the URLs.
Urls like http://www.example.com/coolpage and http://www.example.com/coolpage#!anyparameter=anyvalue are the same for Goolgle Analytics. That's likely the reason why their URL builder tool doesn't accept that.
By the way, Ecwid uses fragment part of the URL all the time to address the product and category pages, but that's not an issue if you want to track your product pages in Google Analytics. Ecwid solved that problem by sending special 'virtual' page views to Google Analytics every time a customer browses your store. So in your GA reports you will see your store pages.
3) If you use Google Adwords for your ad campaigns, I'd suggest linking your Google Analytics and Google Adwords profiles to have better picture of customer behavior and the campaign performance. Check out this thread on Ecwid forums for the details:
http://www.ecwid.com/forums/showthread.php?t=10835

Resources