I'm working on this Wordpress website and trying to change the video background of the slider on the homepage. I see it in the code, I see it in the site editor, and it seems to be part of a revolution slider, yet in this slider's properties, I cannot find any instruction relating to it.
Has anyone worked with this situation before? Did I miss something obvious? or did I just research the wrong question?
Here is the JSON definition of the slider in question:
{
"addOns": [],
"carousel": {
"borderRadius": 0,
"borderRadiusUnit": "px",
"ease": "power3.inOut",
"fadeOut": true,
"horizontal": "center",
"infinity": false,
"justify": false,
"justifyMaxWidth": false,
"maxItems": 3,
"maxOpacity": 100,
"maxRotation": 0,
"offsetScale": false,
"paddingBottom": 0,
"paddingTop": 0,
"rotation": false,
"scale": false,
"scaleDown": 50,
"showAllLayers": "false",
"snap": true,
"space": 0,
"speed": 800,
"stretch": false,
"varyFade": false,
"varyRotate": false,
"varyScale": false,
"vertical": "center"
},
"class": "",
"codes": {
"css": "",
"javascript": ""
},
"def": {
"autoResponsive": true,
"background": {
"fit": "cover",
"fitX": 100,
"fitY": 100,
"imageSourceType": "full",
"position": "center center",
"positionX": 0,
"positionY": 0,
"repeat": "no-repeat"
},
"delay": 9000,
"intelligentInherit": true,
"panZoom": {
"blurEnd": 0,
"blurStart": 0,
"duration": 10000,
"ease": "none",
"fitEnd": 100,
"fitStart": 100,
"rotateEnd": 0,
"rotateStart": 0,
"set": false,
"xEnd": 0,
"xStart": 0,
"yEnd": 0,
"yStart": 0
},
"responsiveChilds": true,
"responsiveOffset": true,
"transition": "fade",
"transitionDuration": 300
},
"general": {
"autoPlayVideoOnMobile": true,
"disableFocusListener": false,
"disableOnMobile": false,
"disablePanZoomMobile": false,
"firstSlide": {
"alternativeFirstSlide": 1,
"alternativeFirstSlideSet": false,
"duration": 300,
"set": false,
"slotAmount": 7,
"type": "fade"
},
"layerSelection": false,
"lazyLoad": "none",
"nextSlideOnFocus": false,
"progressbar": {
"color": "rgba(255,255,255,0.5)",
"height": 5,
"position": "bottom",
"set": false
},
"slideshow": {
"initDelay": 0,
"loopSingle": false,
"presetSliderHeight": false,
"shuffle": false,
"slideShow": true,
"stopAfterLoops": 0,
"stopAtSlide": 1,
"stopOnHover": false,
"stopSlider": false,
"viewPort": false,
"viewPortArea": {
"d": {
"e": false,
"u": "",
"v": "200px"
},
"m": {
"e": false,
"u": "",
"v": "200px"
},
"n": {
"e": false,
"u": "",
"v": "200px"
},
"t": {
"e": false,
"u": "",
"v": "200px"
}
},
"viewPortStart": "wait",
"waitForInit": false
},
"useWPML": false
},
"googleFont": [],
"hero": {
"activeSlide": -1
},
"id": "",
"layout": {
"bg": {
"color": "transparent",
"dottedOverlay": "none",
"fit": "cover",
"image": "",
"imageSourceType": "full",
"padding": 0,
"position": "center center",
"repeat": "no-repeat",
"shadow": 0,
"useImage": false
},
"position": {
"addClear": false,
"align": "center",
"fixedOnTop": false,
"marginBottom": 0,
"marginLeft": 0,
"marginRight": 0,
"marginTop": 0
},
"spinner": {
"color": "#ffffff",
"type": "0"
}
},
"layouttype": "fullwidth",
"modal": {
"bodyclass": "",
"cover": true,
"coverColor": "rgba(0,0,0,0.5)",
"horizontal": "center",
"vertical": "middle"
},
"modalshortcode": "[rev_slider usage=\"modal\" alias=\"slider-1\"][/rev_slider]",
"nav": {
"arrows": {
"alwaysOn": true,
"animDelay": "1000ms",
"animSpeed": "1000ms",
"hideDelay": 200,
"hideDelayMobile": 1200,
"hideOver": false,
"hideOverLimit": 0,
"hideUnder": false,
"hideUnderLimit": 778,
"left": {
"align": "slider",
"anim": "fade",
"horizontal": "left",
"offsetX": 30,
"offsetY": 0,
"vertical": "center"
},
"preset": "default",
"presets": [],
"right": {
"align": "slider",
"anim": "fade",
"horizontal": "right",
"offsetX": 30,
"offsetY": 0,
"vertical": "center"
},
"rtl": false,
"set": false,
"style": "1000"
},
"bullets": {
"align": "slider",
"alwaysOn": true,
"anim": "fade",
"animDelay": "1000ms",
"animSpeed": "1000ms",
"direction": "horizontal",
"hideDelay": 200,
"hideDelayMobile": 1200,
"hideOver": false,
"hideOverLimit": 0,
"hideUnder": false,
"hideUnderLimit": 778,
"horizontal": "center",
"offsetX": 0,
"offsetY": 20,
"preset": "default",
"presets": [],
"rtl": false,
"set": false,
"space": 5,
"style": "3000",
"vertical": "bottom"
},
"keyboard": {
"direction": "horizontal",
"set": false
},
"mouse": {
"reverse": "default",
"set": "off"
},
"preview": {
"height": 100,
"width": 50
},
"swipe": {
"blockDragVertical": false,
"direction": "horizontal",
"minTouch": 1,
"set": false,
"setDesktopCarousel": true,
"setMobileCarousel": true,
"setOnDesktop": false,
"velocity": 75
},
"tabs": {
"align": "slider",
"alwaysOn": true,
"amount": 5,
"anim": "fade",
"animDelay": "1000ms",
"animSpeed": "1000ms",
"direction": "horizontal",
"height": 50,
"hideDelay": 200,
"hideDelayMobile": 1200,
"hideOver": false,
"hideOverLimit": 0,
"hideUnder": false,
"hideUnderLimit": 778,
"horizontal": "center",
"innerOuter": "inner",
"offsetX": 0,
"offsetY": 20,
"padding": 5,
"preset": "default",
"presets": [],
"rtl": false,
"set": false,
"space": 5,
"spanWrapper": false,
"style": "4000",
"vertical": "bottom",
"width": 100,
"widthMin": 100,
"wrapperColor": "transparent"
},
"thumbs": {
"align": "slider",
"alwaysOn": true,
"amount": 5,
"anim": "fade",
"animDelay": "1000ms",
"animSpeed": "1000ms",
"direction": "horizontal",
"height": 50,
"hideDelay": 200,
"hideDelayMobile": 1200,
"hideOver": false,
"hideOverLimit": 0,
"hideUnder": false,
"hideUnderLimit": 778,
"horizontal": "center",
"innerOuter": "inner",
"offsetX": 0,
"offsetY": 20,
"padding": 5,
"preset": "default",
"presets": [],
"rtl": false,
"set": false,
"space": 5,
"spanWrapper": false,
"style": "2000",
"vertical": "bottom",
"width": 100,
"widthMin": 100,
"wrapperColor": "transparent"
}
},
"parallax": {
"ddd": {
"BGFreeze": false,
"layerOverflow": false,
"overflow": false,
"shadow": false,
"zCorrection": 65
},
"disableOnMobile": false,
"levels": [
5,
10,
15,
20,
25,
30,
35,
40,
45,
46,
47,
48,
49,
50,
51,
30
],
"mouse": {
"bgSpeed": 0,
"layersSpeed": 0,
"origo": "slidercenter",
"speed": 0,
"type": "scroll"
},
"set": false,
"setDDD": false
},
"scrolleffects": {
"bg": false,
"direction": "both",
"disableOnMobile": false,
"layers": false,
"maxBlur": 10,
"multiplicator": "1.3",
"multiplicatorLayers": "1.3",
"parallaxLayers": false,
"set": false,
"setBlur": false,
"setFade": false,
"setGrayScale": false,
"staticLayers": false,
"staticParallaxLayers": false,
"tilt": 30
},
"scrolltimeline": {
"ease": "none",
"fixed": false,
"fixedEnd": 4000,
"fixedStart": 2000,
"layers": false,
"set": false,
"speed": 500
},
"shortcode": "[rev_slider alias=\"slider-1\"][/rev_slider]",
"size": {
"custom": {
"d": true,
"m": true,
"n": true,
"t": true
},
"disableForceFullWidth": false,
"editorCache": {
"d": 500,
"m": 270,
"n": 600,
"t": 430
},
"forceOverflow": false,
"fullScreenOffset": "",
"fullScreenOffsetContainer": "",
"gridEQModule": false,
"height": {
"d": "500px",
"m": "270px",
"n": "600px",
"t": "430px"
},
"keepBPHeight": false,
"maxHeight": 0,
"maxWidth": 0,
"minHeight": "",
"minHeightFullScreen": "",
"overflow": false,
"overflowHidden": false,
"respectAspectRatio": false,
"useFullScreenHeight": true,
"width": {
"d": 1240,
"m": 480,
"n": 1024,
"t": 778
}
},
"skins": {
"cid": 2,
"colors": [
{
"alias": "Highlight",
"ref": [],
"v": "#ff0000"
},
{
"alias": "Headline Text",
"ref": [],
"v": "#ffffff"
},
{
"alias": "Content Text",
"ref": [],
"v": "#00ffff"
}
],
"colorsAtStart": false
},
"snap": {
"adjust": "none",
"gap": 20,
"helpLines": false,
"snap": false
},
"source": {
"facebook": {
"album": "",
"appId": "",
"appSecret": "",
"count": "",
"pageURL": "",
"transient": 1200,
"typeSource": "album"
},
"flickr": {
"apiKey": "",
"count": "",
"galleryURL": "",
"groupURL": "",
"photoSet": "",
"transient": 1200,
"type": "publicphotos",
"userURL": ""
},
"gallery": [],
"instagram": {
"count": "",
"hashTag": "",
"transient": 1200,
"type": "user",
"userId": ""
},
"post": {
"category": "",
"excerptLimit": 55,
"fetchType": "cat_tag",
"list": "",
"maxPosts": 30,
"sortBy": "ID",
"sortDirection": "DESC",
"subType": "post",
"types": "post"
},
"twitter": {
"accessSecret": "",
"accessToken": "",
"consumerKey": "",
"consumerSecret": "",
"count": "",
"excludeReplies": false,
"imageOnly": false,
"includeRetweets": false,
"transient": 1200,
"userId": ""
},
"vimeo": {
"albumId": "",
"channelName": "",
"count": "",
"groupName": "",
"transient": 1200,
"typeSource": "user",
"userName": ""
},
"woo": {
"category": "",
"excerptLimit": 55,
"featuredOnly": false,
"inStockOnly": false,
"maxProducts": 30,
"regPriceFrom": "",
"regPriceTo": "",
"salePriceFrom": "",
"salePriceTo": "",
"sortBy": "ID",
"sortDirection": "DESC",
"types": "product"
},
"youtube": {
"api": "",
"channelId": "",
"count": "",
"playList": "",
"transient": 1200,
"typeSource": "channel"
}
},
"sourcetype": "gallery",
"troubleshooting": {
"alternateImageType": "off",
"alternateURL": "",
"ignoreHeightChanges": false,
"ignoreHeightChangesUnderLimit": 0,
"jsInBody": false,
"jsNoConflict": false,
"outPutFilter": "none",
"simplify_ie8_ios4": false
},
"type": "standard",
"version": "6.2.2",
"visibility": {
"hideAllLayersUnderLimit": 0,
"hideSelectedLayersUnderLimit": 0,
"hideSliderUnderLimit": 0
},
"wrapperclass": ""
}
I can see that is is revolution slider. This is the source I saw for the video
<source src="//askdrdougnow.com/wp-content/uploads/2020/05/videoplayback.webm" type="video/mp4" data-stylerecorder="true" style="text-align: left; line-height: 20px; letter-spacing: 0px; font-weight: 400; border-color: rgb(0, 0, 0); border-style: none; margin: 0px; border-radius: 0px; padding: 0px;">
I know Revolution Slider has a place for editing all sliders and you can set the background of a slider as a video so that is were you would need to find and remove it.
Related
The problem is that I get this excerpt of a product from Woocommerce:
[
{
"id": 73,
"name": "cBox",
"slug": "cbox",
"sku": "",
"price": "169",
"regular_price": "169",
"sale_price": "",
"on_sale": false,
"purchasable": true,
"total_sales": 0,
"virtual": false,
"downloadable": false,
"downloads": [],
"download_limit": -1,
"download_expiry": -1,
"external_url": "",
"button_text": "",
"tax_status": "taxable",
"tax_class": "",
"manage_stock": false,
"stock_quantity": null,
"backorders": "no",
"backorders_allowed": false,
"backordered": false,
"low_stock_amount": null,
"sold_individually": false,
"shipping_required": true,
"shipping_taxable": true,
"shipping_class": "",
"shipping_class_id": 0,
"reviews_allowed": true,
"average_rating": "0.00",
"rating_count": 0,
"upsell_ids": [],
"cross_sell_ids": [],
"parent_id": 0,
"purchase_note": "",
"attributes": [],
"default_attributes": [],
"variations": [],
"grouped_products": [],
"menu_order": 0,
"stock_status": "instock",
"has_options": true,
"translations": {
"de": "73",
"en": "76"
},
"lang": "de",
}
]
You can see the translations, at least the ID's of the translated products. My question is how can I get directly via rest-api only the translated products?
Because with the property "lang=en" it does not work in the url
What does your request look like?
It should work with the lang parameter, you can read more here: https://wpml.org/documentation/related-projects/woocommerce-multilingual/using-wordpress-rest-api-woocommerce-multilingual/
I have a field group named 'Sales Item' and 'Invoice'. The invoice field group have a 'Items' field which is a repeater field, the 'Items' field contains the 'Sales Item' field group as clone field.
I need to create an Invoice post type programmatically. All the field of the 'Invoice' is created except the 'Items' field. How do I add the data to the 'Items' reaper field which contain the 'Sales Item' clone field?
Sales Item and Invoice field group.
[
{
"key": "group_5c4033565a799",
"title": "Invoice",
"fields": [
{
"key": "field_5c44150d123de",
"label": "Type",
"name": "ims_invoice_type",
"type": "select",
"instructions": "",
"required": 1,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"choices": {
"sales": "Sales",
"purchases": "Purchases"
},
"default_value": [
"purchases"
],
"allow_null": 0,
"multiple": 0,
"ui": 0,
"return_format": "value",
"ajax": 0,
"placeholder": ""
},
{
"key": "field_5c4033c40bce3",
"label": "Invoice Number",
"name": "ims_invoice_invoice_number",
"type": "text",
"instructions": "",
"required": 1,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"default_value": "",
"maxlength": "",
"placeholder": "",
"prepend": "",
"append": ""
},
{
"key": "field_5c4e943170485",
"label": "Customer",
"name": "ims_invoice_customer",
"type": "relationship",
"instructions": "",
"required": 1,
"conditional_logic": [
[
{
"field": "field_5c44150d123de",
"operator": "==",
"value": "sales"
}
]
],
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"post_type": [
"ims_customer"
],
"taxonomy": "",
"filters": [
"search",
"post_type",
"taxonomy"
],
"elements": "",
"min": 1,
"max": 1,
"return_format": "object"
},
{
"key": "field_5c4033620bce1",
"label": "Vendor",
"name": "ims_invoice_vendor",
"type": "relationship",
"instructions": "",
"required": 1,
"conditional_logic": [
[
{
"field": "field_5c44150d123de",
"operator": "==",
"value": "purchases"
}
]
],
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"post_type": [
"ims_vendor"
],
"taxonomy": "",
"filters": [
"search",
"post_type",
"taxonomy"
],
"elements": "",
"min": 1,
"max": 1,
"return_format": "object"
},
{
"key": "field_5c40339b0bce2",
"label": "Date",
"name": "ims_invoice_date",
"type": "date_picker",
"instructions": "",
"required": 1,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"display_format": "F j, Y",
"return_format": "d\/m\/Y",
"first_day": 0
},
{
"key": "field_5c4034030cff9",
"label": "Items",
"name": "ims_invoice_sales_items",
"type": "repeater",
"instructions": "",
"required": 1,
"conditional_logic": [
[
{
"field": "field_5c44150d123de",
"operator": "==",
"value": "sales"
}
]
],
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"collapsed": "",
"min": 0,
"max": 0,
"layout": "table",
"button_label": "Add Product",
"sub_fields": [
{
"key": "field_5c443f4dd87de",
"label": "Item",
"name": "ims_invoice_sales_items",
"type": "clone",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"clone": [
"group_5c443e86ad330"
],
"display": "seamless",
"layout": "block",
"prefix_label": 0,
"prefix_name": 1
}
]
},
{
"key": "field_5c78f715c5efe",
"label": "Items",
"name": "ims_invoice_purchases_items",
"type": "repeater",
"instructions": "",
"required": 1,
"conditional_logic": [
[
{
"field": "field_5c44150d123de",
"operator": "==",
"value": "purchases"
}
]
],
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"collapsed": "",
"min": 0,
"max": 0,
"layout": "table",
"button_label": "Add Product",
"sub_fields": [
{
"key": "field_5c78f730c5eff",
"label": "Items",
"name": "ims_invoice_purchases_items",
"type": "clone",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"clone": [
"group_5c78e0e32443c"
],
"display": "seamless",
"layout": "block",
"prefix_label": 0,
"prefix_name": 1
}
]
},
{
"key": "field_5c41b2ff17b09",
"label": "Sub Total",
"name": "ims_invoice_sub_total",
"type": "read_only",
"instructions": "",
"required": 1,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"copy_to_clipboard": 0,
"display_type": "text"
},
{
"key": "field_5c41b31a17b0b",
"label": "Discount",
"name": "ims_invoice_discount",
"type": "number",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"default_value": "0.0",
"placeholder": "",
"prepend": "",
"append": "",
"min": 0,
"max": "",
"step": ""
},
{
"key": "field_5c41b32617b0c",
"label": "V.A.T",
"name": "ims_invoice_vat",
"type": "number",
"instructions": "",
"required": 1,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"default_value": "0.0",
"placeholder": "",
"prepend": "",
"append": "",
"min": 0,
"max": "",
"step": ""
},
{
"key": "field_5c41b33317b0d",
"label": "Total",
"name": "ims_invoice_total",
"type": "read_only",
"instructions": "",
"required": 1,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"copy_to_clipboard": 0,
"display_type": "text"
},
{
"key": "field_5c41b33b17b0e",
"label": "Paid",
"name": "ims_invoice_paid",
"type": "number",
"instructions": "",
"required": 1,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"default_value": "0.0",
"placeholder": "",
"prepend": "",
"append": "",
"min": 0,
"max": "",
"step": ""
},
{
"key": "field_5c41b34517b0f",
"label": "Due",
"name": "ims_invoice_due",
"type": "read_only",
"instructions": "",
"required": 1,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"copy_to_clipboard": 0,
"display_type": "text"
}
],
"location": [
[
{
"param": "post_type",
"operator": "==",
"value": "ims_invoice"
}
]
],
"menu_order": 0,
"position": "normal",
"style": "default",
"label_placement": "left",
"instruction_placement": "label",
"hide_on_screen": "",
"active": 1,
"description": ""
},
{
"key": "group_5c443e86ad330",
"title": "Sales Item",
"fields": [
{
"key": "field_5c443eab22fe1",
"label": "Item",
"name": "sales_item_item",
"type": "post_object",
"instructions": "",
"required": 1,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"post_type": [
"ims_product"
],
"taxonomy": "",
"allow_null": 0,
"multiple": 0,
"return_format": "object",
"ui": 1
},
{
"key": "field_5c779ac395834",
"label": "SKU",
"name": "sales_item_sku",
"type": "read_only",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"copy_to_clipboard": 0,
"display_type": "text"
},
{
"key": "field_5c443eba22fe2",
"label": "Quantity",
"name": "sales_item_quantity",
"type": "number",
"instructions": "",
"required": 1,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"default_value": 1,
"placeholder": "",
"prepend": "",
"append": "",
"min": "",
"max": "",
"step": ""
},
{
"key": "field_5c443ec622fe3",
"label": "Unit Price",
"name": "sales_item_unit_price",
"type": "read_only",
"instructions": "",
"required": 1,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"copy_to_clipboard": 0,
"display_type": "text"
},
{
"key": "field_5c443edf22fe4",
"label": "Price",
"name": "sales_item_price",
"type": "read_only",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"copy_to_clipboard": 0,
"display_type": "text"
},
{
"key": "field_5c443efd22fe5",
"label": "Discount",
"name": "sales_item_discount",
"type": "number",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"default_value": "0.0",
"placeholder": "",
"prepend": "",
"append": "",
"min": "",
"max": "",
"step": ""
},
{
"key": "field_5c443f0a22fe6",
"label": "Amount",
"name": "sales_item_amount",
"type": "read_only",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"copy_to_clipboard": 0,
"display_type": "text"
}
],
"location": [
[
{
"param": "post_type",
"operator": "==",
"value": "post"
}
]
],
"menu_order": 0,
"position": "normal",
"style": "default",
"label_placement": "top",
"instruction_placement": "label",
"hide_on_screen": "",
"active": 0,
"description": ""
}
]
Here is the code, I have written so far.
$invoice_key = 'ims_invoice_sales_items_';
$customer_id = $_POST['customer_id'];
$ims_products = $_POST['ims_product'];
$basket_discount = $_POST['basket_discount'];
$basket_vat = $_POST['basket_vat'];
$paid = $_POST['paid'];
$sub_total = 0.0;
foreach( $ims_products as $ims_product ) {
$id = $ims_product['id'];
$quantity = intval( $ims_product['quantity'] );
$unit_price = floatval( get_field( 'ims_product_mrp', $id ) );
$discount = floatval( $ims_product['discount'] );
$price = $quantity * $unit_price;
$amount = $price - ( $discount * $price ) / 100.0;
$sub_total += $amount;
$items [] = array(
$invoice_key . 'sales_item_item' => $id,
$invoice_key . 'sales_item_sku' => get_field( 'ims_product_sku', $id ),
$invoice_key . 'sales_item_quantity' => $quantity,
$invoice_key . 'sales_item_unit_price' => $unit_price,
$invoice_key . 'sales_item_price' => $price,
$invoice_key . 'sales_item_discount' => $discount,
$invoice_key . 'sales_item_amount' => $amount
);
}
// var_dump( $items );
// Calculate grand total after discount and vat.
$grand_total = $sub_total - ( $basket_discount * $sub_total ) / 100.0;
$grand_total = $grand_total + ( $basket_vat * $grand_total ) / 100.0;
// Calculate due.
$due = $grand_total - $paid;
$meta_inputs = array(
'ims_invoice_type' => 'sales',
'ims_invoice_invoice_number' => uniqid(),
'ims_invoice_customer' => $customer_id,
'ims_invoice_date' => current_time('d/m/Y', false ),
'ims_invoice_sub_total' => $sub_total,
'ims_invoice_discount' => $basket_discount,
'ims_invoice_vat' => $basket_vat,
'ims_invoice_total' => $grand_total,
'ims_invoice_paid' => $paid,
'ims_invoice_due' => $due
);
$invoice_args = array(
'post_type' => 'ims_invoice',
'post_status' => 'publish',
'meta_input' => $meta_inputs
);
// var_dump( $invoice_args );
$post_id = wp_insert_post( $invoice_args, true );
var_dump( "<h1>Post Id = ${post_id}</h1>");
foreach( $items as $item ) {
var_dump( $item );
add_row( 'ims_invoice_sales_items', $item, $post_id );
}
die;
You don't actually need to call add_row and add each repeater entry in sequence. You can push the entire items array in one go. You will need to do following things to make sure that the below conditions are met and the code will work for you.
You have the correct field key for your repeater field (Something to the effect of field_5bfed0e63a470).
The slug of each repeating element in the repeater group is correct(For example repeater group has a field sales item and the slug for it is in the format sales_item_item).
Once You have made sure of that you just need to create an array of the new items set as you have already created with $items variable and call the below code:
$items_inserted = update_field('field_5bfed0e63a470', $items, $post_id);
Things should work fine for you with this. Good Luck!!!
folks,
I am trying to use jq to get the json values from the json file, It should give me t1, t2 and t3 but it gives me null value. I have included the json file below, I tried doing jq various options. I want to get the t1, t2, t3 values from the field 'name' and then assign the values to a array which is variable so that I can refer to the array and do a POST.
jq '.name' good.json
null
$ cat good.json
{
"kind": "tm:ltm:virtual:virtualcollectionstate",
"selfLink": "https://localhost/mgmt/tm/ltm/virtual?ver=12.0.0",
"items": [
{
"kind": "tm:ltm:virtual:virtualstate",
"name": "t1",
"partition": "Common",
"fullPath": "/Common/t1",
"generation": 124,
"selfLink": "https://localhost/mgmt/tm/ltm/virtual/~Common~t1?ver=12.0.0",
"addressStatus": "yes",
"autoLasthop": "default",
"cmpEnabled": "yes",
"connectionLimit": 0,
"destination": "/Common/3.3.3.3:80",
"enabled": true,
"gtmScore": 0,
"ipProtocol": "tcp",
"mask": "255.255.255.255",
"mirror": "disabled",
"mobileAppTunnel": "disabled",
"nat64": "disabled",
"rateLimit": "disabled",
"rateLimitDstMask": 0,
"rateLimitMode": "object",
"rateLimitSrcMask": 0,
"serviceDownImmediateAction": "none",
"source": "0.0.0.0/0",
"sourceAddressTranslation": {
"type": "none"
},
"sourcePort": "preserve",
"synCookieStatus": "not-activated",
"translateAddress": "enabled",
"translatePort": "enabled",
"vlansDisabled": true,
"vsIndex": 21,
"policiesReference": {
"link": "https://localhost/mgmt/tm/ltm/virtual/~Common~t1/policies?ver=12.0.0",
"isSubcollection": true
},
"profilesReference": {
"link": "https://localhost/mgmt/tm/ltm/virtual/~Common~t1/profiles?ver=12.0.0",
"isSubcollection": true
}
},
{
"kind": "tm:ltm:virtual:virtualstate",
"name": "t2",
"partition": "Common",
"fullPath": "/Common/t2",
"generation": 178,
"selfLink": "https://localhost/mgmt/tm/ltm/virtual/~Common~t2?ver=12.0.0",
"addressStatus": "yes",
"autoLasthop": "default",
"cmpEnabled": "yes",
"connectionLimit": 0,
"destination": "/Common/4.4.4.4:80",
"enabled": true,
"gtmScore": 0,
"ipProtocol": "tcp",
"mask": "255.255.255.255",
"mirror": "disabled",
"mobileAppTunnel": "disabled",
"nat64": "disabled",
"rateLimit": "disabled",
"rateLimitDstMask": 0,
"rateLimitMode": "object",
"rateLimitSrcMask": 0,
"serviceDownImmediateAction": "none",
"source": "0.0.0.0/0",
"sourceAddressTranslation": {
"type": "none"
},
"sourcePort": "preserve",
"synCookieStatus": "not-activated",
"translateAddress": "enabled",
"translatePort": "enabled",
"vlansDisabled": true,
"vsIndex": 22,
"policiesReference": {
"link": "https://localhost/mgmt/tm/ltm/virtual/~Common~t2/policies?ver=12.0.0",
"isSubcollection": true
},
"profilesReference": {
"link": "https://localhost/mgmt/tm/ltm/virtual/~Common~t2/profiles?ver=12.0.0",
"isSubcollection": true
}
},
{
"kind": "tm:ltm:virtual:virtualstate",
"name": "t3",
"partition": "Common",
"fullPath": "/Common/t3",
"generation": 179,
"selfLink": "https://localhost/mgmt/tm/ltm/virtual/~Common~t3?ver=12.0.0",
"addressStatus": "yes",
"autoLasthop": "default",
"cmpEnabled": "yes",
"connectionLimit": 0,
"destination": "/Common/5.5.5.5:80",
"enabled": true,
"gtmScore": 0,
"ipProtocol": "tcp",
"mask": "255.255.255.255",
"mirror": "disabled",
"mobileAppTunnel": "disabled",
"nat64": "disabled",
"rateLimit": "disabled",
"rateLimitDstMask": 0,
"rateLimitMode": "object",
"rateLimitSrcMask": 0,
"serviceDownImmediateAction": "none",
"source": "0.0.0.0/0",
"sourceAddressTranslation": {
"type": "none"
},
"sourcePort": "preserve",
"synCookieStatus": "not-activated",
"translateAddress": "enabled",
"translatePort": "enabled",
"vlansDisabled": true,
"vsIndex": 23,
"policiesReference": {
"link": "https://localhost/mgmt/tm/ltm/virtual/~Common~t3/policies?ver=12.0.0",
"isSubcollection": true
},
"profilesReference": {
"link": "https://localhost/mgmt/tm/ltm/virtual/~Common~t3/profiles?ver=12.0.0",
"isSubcollection": true
}
}
]
}
"name" is not a top-level key. Consider instead:
$ jq '.items[] | .name' good.json
"t1"
"t2"
"t3"
I need to add labels with difference of 10 in both axis( one each between the grid ), WITHOUT compromising the present number of grids.So the number of grid lines should stay 11 and number of labels will go up to 21. Hope that clears my query.Above is my chart, and this is the code -
var chart = AmCharts.makeChart("chartdiv", {
"type": "xy",
"dataProvider": json,
"valueAxes":
[
{
"id":"my_y",
"autoGridCount": false,
"position": "right",
"tickLength":0,
"gridThickness":0.25,
"minimum":-100,
"maximum":100,
"gridCount": 11,
"labelFrequency" : 0.5,
"gridColor":"black",
"gridAlpha":0.50,
"labelOffset": -356,
"axisAlpha":0,
"strictGridCount" : true,
},
{
"id":"my_x",
"autoGridCount": false,
"position": "bottom",
"tickLength":0,
"gridThickness": 0.25,
"minimum":-100,
"maximum":100,
"gridCount": 11,
"labelFrequency" : 0.5,
"gridColor":"black",
"gridAlpha":0.50,
"labelOffset": -320,
"axisAlpha":0,
},
],
"borderAlpha" : 0,
"startDuration": 0,
"legend":[{
"useGraphSettings": false,
"verticalGap":0,
}],
"guides":[
{
"fillAlpha": 0.10,
"value": -100,
"toValue": 100,
}
],
"graphs":
[
{
"id":"g1",
"lineColor": "#FF6600",
"bulletBorderThickness": 1,
"hideBulletsCount": 30,
"animationDuration":0,
"balloonText": "[[value]]",
"bullet": "circle",
"lineAlpha": 0,
"valueField": "value",
"xField": "x",
"yField": "y",
"fillAlphas": 0,
"bulletBorderAlpha": 0,
"minBulletSize": 30,
"maxBulletSize": 30,
"labelText":"[[x]]",
"labelPosition":"inside",
"markerType" : "none",
"switchable":false,
},
],
"marginLeft": 20,
"marginBottom": 20,
"export": {
"enabled": true,
"menu" : [],
},
});
PS : I tried to change the labelFrequency value but I don't think it takes values below 1.
You're right to assume that labelFrequency can't be set to anything lower than 1, or a non-integer for that matter.
The only workaround I can think of is to increase gridCount to the number which displays labels in increments that you want. I.e. 21.
Then disable grid lines altogether. (gridAlpha: 0)
And finally use guides to display lines at values that you need lines displayed at. I.e.:
{
"id": "my_y",
"autoGridCount": false,
"position": "right",
"tickLength": 0,
"gridThickness": 0.25,
"minimum": -100,
"maximum": 100,
"gridCount": 21,
"labelFrequency": 0.5,
"gridColor": "black",
"gridAlpha": 0,
"labelOffset": -356,
"axisAlpha": 0,
"strictGridCount": true,
"guides": [
{ "value": 80, "lineAlpha": 0.5 },
{ "value": 60, "lineAlpha": 0.5 },
{ "value": 40, "lineAlpha": 0.5 },
{ "value": 20, "lineAlpha": 0.5 },
{ "value": 0, "lineAlpha": 0.5 },
{ "value": -20, "lineAlpha": 0.5 },
{ "value": -40, "lineAlpha": 0.5 },
{ "value": -60, "lineAlpha": 0.5 },
{ "value": -80, "lineAlpha": 0.5 }
]
}
I am pretty sure it used to work this way, but now I can't make it work anymore... This is the problem:
$ docker run -d -p 80:80 --name frontend -v $(pwd)/nginx.conf:/etc/nginx/nginx.conf -v $(pwd)/htpasswd:/htpasswd nginx
I want to have this nginx.conf file that I want to edit in the host and, then, simply run
$ docker exec -ti frontend nginx -s reload
And have my frontend server reloaded. But I can't see the changes in nginx.conf from inside the container. Why is that?
In case this helps:
[
{
"Id": "39ceafd41f7576638d4b129ea90b0522aa61f25d62e68e361de905638ba74f60",
"Created": "2016-07-07T18:59:35.917569545Z",
"Path": "nginx",
"Args": [
"-g",
"daemon off;"
],
"State": {
"Status": "running",
"Running": true,
"Paused": false,
"Restarting": false,
"OOMKilled": false,
"Dead": false,
"Pid": 17786,
"ExitCode": 0,
"Error": "",
"StartedAt": "2016-07-07T18:59:36.241298894Z",
"FinishedAt": "0001-01-01T00:00:00Z"
},
"Image": "sha256:0d409d33b27e47423b049f7f863faa08655a8c901749c2b25b93ca67d01a470d",
"ResolvConfPath": "/var/lib/docker/containers/39ceafd41f7576638d4b129ea90b0522aa61f25d62e68e361de905638ba74f60/resolv.conf",
"HostnamePath": "/var/lib/docker/containers/39ceafd41f7576638d4b129ea90b0522aa61f25d62e68e361de905638ba74f60/hostname",
"HostsPath": "/var/lib/docker/containers/39ceafd41f7576638d4b129ea90b0522aa61f25d62e68e361de905638ba74f60/hosts",
"LogPath": "/var/lib/docker/containers/39ceafd41f7576638d4b129ea90b0522aa61f25d62e68e361de905638ba74f60/39ceafd41f7576638d4b129ea90b0522aa61f25d62e68e361de905638ba74f60-json.log",
"Name": "/frontend",
"RestartCount": 0,
"Driver": "devicemapper",
"MountLabel": "",
"ProcessLabel": "",
"AppArmorProfile": "",
"ExecIDs": null,
"HostConfig": {
"Binds": [
"/home/jpmelos/nginx.conf:/etc/nginx/nginx.conf",
"/home/jpmelos/htpasswd:/htpasswd"
],
"ContainerIDFile": "",
"LogConfig": {
"Type": "json-file",
"Config": {}
},
"NetworkMode": "infra",
"PortBindings": {
"80/tcp": [
{
"HostIp": "",
"HostPort": "80"
}
]
},
"RestartPolicy": {
"Name": "no",
"MaximumRetryCount": 0
},
"AutoRemove": false,
"VolumeDriver": "",
"VolumesFrom": null,
"CapAdd": null,
"CapDrop": null,
"Dns": [],
"DnsOptions": [],
"DnsSearch": [],
"ExtraHosts": null,
"GroupAdd": null,
"IpcMode": "",
"Cgroup": "",
"Links": null,
"OomScoreAdj": 0,
"PidMode": "",
"Privileged": false,
"PublishAllPorts": false,
"ReadonlyRootfs": false,
"SecurityOpt": null,
"StorageOpt": null,
"UTSMode": "",
"UsernsMode": "",
"ShmSize": 67108864,
"ConsoleSize": [
0,
0
],
"Isolation": "",
"CpuShares": 0,
"Memory": 0,
"CgroupParent": "",
"BlkioWeight": 0,
"BlkioWeightDevice": null,
"BlkioDeviceReadBps": null,
"BlkioDeviceWriteBps": null,
"BlkioDeviceReadIOps": null,
"BlkioDeviceWriteIOps": null,
"CpuPeriod": 0,
"CpuQuota": 0,
"CpusetCpus": "",
"CpusetMems": "",
"Devices": [],
"DiskQuota": 0,
"KernelMemory": 0,
"MemoryReservation": 0,
"MemorySwap": 0,
"MemorySwappiness": -1,
"OomKillDisable": false,
"PidsLimit": 0,
"Ulimits": null,
"CpuCount": 0,
"CpuPercent": 0,
"BlkioIOps": 0,
"BlkioBps": 0,
"SandboxSize": 0
},
"GraphDriver": {
"Name": "devicemapper",
"Data": {
"DeviceId": "3660",
"DeviceName": "docker-253:0-3147678-71e674d2c1754f73d3fdd933a1971bf8464f6aa6b738dc818a668beb96a4e6ea",
"DeviceSize": "10737418240"
}
},
"Mounts": [
{
"Source": "/home/jpmelos/nginx.conf",
"Destination": "/etc/nginx/nginx.conf",
"Mode": "",
"RW": true,
"Propagation": "rprivate"
},
{
"Source": "/home/jpmelos/htpasswd",
"Destination": "/htpasswd",
"Mode": "",
"RW": true,
"Propagation": "rprivate"
}
],
"Config": {
"Hostname": "39ceafd41f75",
"Domainname": "",
"User": "",
"AttachStdin": false,
"AttachStdout": false,
"AttachStderr": false,
"ExposedPorts": {
"443/tcp": {},
"80/tcp": {}
},
"Tty": false,
"OpenStdin": false,
"StdinOnce": false,
"Env": [
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
"NGINX_VERSION=1.11.1-1~jessie"
],
"Cmd": [
"nginx",
"-g",
"daemon off;"
],
"Image": "nginx",
"Volumes": null,
"WorkingDir": "",
"Entrypoint": null,
"OnBuild": null,
"Labels": {}
},
"NetworkSettings": {
"Bridge": "",
"SandboxID": "c20b1912f3689cf6b82d19b2ae3173e050b3958e266dd19dd047aeccacabef55",
"HairpinMode": false,
"LinkLocalIPv6Address": "",
"LinkLocalIPv6PrefixLen": 0,
"Ports": {
"443/tcp": null,
"80/tcp": [
{
"HostIp": "0.0.0.0",
"HostPort": "80"
}
]
},
"SandboxKey": "/var/run/docker/netns/c20b1912f368",
"SecondaryIPAddresses": null,
"SecondaryIPv6Addresses": null,
"EndpointID": "",
"Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"IPAddress": "",
"IPPrefixLen": 0,
"IPv6Gateway": "",
"MacAddress": "",
"Networks": {
"infra": {
"IPAMConfig": null,
"Links": null,
"Aliases": null,
"NetworkID": "4598916660ed5453a5ec48412452b00ef6dce24f64b5e315b625596a806442c1",
"EndpointID": "9e7d50cdfbdcec31331655b167ec0e6c5ee20b6e3cc7122222706f99418732d2",
"Gateway": "172.18.0.1",
"IPAddress": "172.18.0.2",
"IPPrefixLen": 16,
"IPv6Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"MacAddress": "02:42:ac:12:00:02"
}
}
}
}
]
Interesting bit: the Mounts section says the mountpoints are rprivate. This might be the problem, but I researched and I couldn't find anything about it...
Looks like the answer is that Docker does not allow editing shared files, just files inside shared directories. When I put my configuration files inside a shared directory and included them from nginx.conf, then it all worked.