How to Use API

Api Url Endpoint: https://titly.site/wp-json/cls/v1/shorten


Method: POST


Parameters:
api_key – Your API key
url – The URL to shorten
custom_code – (Optional) Custom short code for the URL


Example Request:
curl -X POST https://titly.site/wp-json/cls/v1/shorten\
-H “Content-Type: application/x-www-form-urlencoded” \
-d “api_key=YOUR_API_KEY&url=https://example.com&custom_code=mylink”

Another Example:
fetch(“https://titly.site/wp-json/cls/v1/shorten”, {
method: “POST”,
headers: { “Content-Type”: “application/x-www-form-urlencoded” },
body: url=${encodeURIComponent(longUrl)}&api_key=ADD YOUR API HERE&custom_code=${encodeURIComponent(customCode)}
})

Click Here to Request WordPress Plugin

\n'; var baseFontSize = 14; var textarea = editorContainer.find('.code-editor-textarea'); var iframe = editorContainer.find('.code-preview-iframe'); var editorInstance = null;// Initialize CodeMirror if (typeof CodeMirror !== 'undefined') { editorInstance = CodeMirror.fromTextArea(textarea[0], { mode: "htmlmixed", lineNumbers: true, lineWrapping: true, extraKeys: { "Ctrl-Space": "autocomplete", "Ctrl-F": function(cm) { cm.execCommand("find"); }, "Ctrl-=": function(cm) { zoomIn(); }, "Ctrl--": function(cm) { zoomOut(); }, "/": function(cm) { var cursor = cm.getCursor(); var token = cm.getTokenAt(cursor); if (token.string === "/") { var line = cm.getLine(cursor.line); var prevChar = line.charAt(cursor.ch - 2); if (prevChar === "<") { cm.closeTag(); } else { cm.replaceSelection("/"); } } else { cm.replaceSelection("/"); } } }, hintOptions: { completeSingle: false, hintValues: { html: CodeMirror.htmlHint, css: CodeMirror.cssHint, javascript: CodeMirror.javascriptHint } }, autoCloseTags: true, matchTags: {bothTags: true}, autoCloseBrackets: true, highlightSelectionMatches: true });// Set initial content var savedCode = localStorage.getItem("savedCode"); editorInstance.setValue(savedCode ? savedCode : defaultHTML); editorInstance.setSize(null, 1200); editorInstance.getWrapperElement().style.fontSize = baseFontSize + 'px';// Zoom functionality function zoomIn() { baseFontSize += 1; editorInstance.getWrapperElement().style.fontSize = baseFontSize + 'px'; }function zoomOut() { if (baseFontSize > 10) { baseFontSize -= 1; editorInstance.getWrapperElement().style.fontSize = baseFontSize + 'px'; } }// Button handlers editorContainer.find('.zoom-in-btn').off('click').on('click', zoomIn); editorContainer.find('.zoom-out-btn').off('click').on('click', zoomOut);// Keyboard shortcuts $(document).on('keydown', function(e) { if ((e.ctrlKey || e.metaKey) && e.key === '=') { e.preventDefault(); zoomIn(); } if ((e.ctrlKey || e.metaKey) && e.key === '-') { e.preventDefault(); zoomOut(); } });// Auto-complete trigger editorInstance.on('inputRead', function(cm, input) { if (input.text && input.text[0].length > 0 && (input.text[0] === '<' || input.text[0] === '/' || input.text[0] === ' ' || input.text[0] === '.' || input.text[0] === '#' || input.text[0] === '(')) { cm.showHint({completeSingle: false}); } });// Real-time preview with debounce var timeout; editorInstance.on('change', function() { clearTimeout(timeout); timeout = setTimeout(updatePreview, 100); });editorContainer.find('.clear-code-btn').off('click').on('click', function() { editorInstance.setValue(defaultHTML); updatePreview(); });editorContainer.find('.save-code-btn').off('click').on('click', function() { localStorage.setItem("savedCode", editorInstance.getValue()); alert("Code saved!"); }); }function updatePreview() { if (!editorInstance) return; var code = editorInstance.getValue(); var iframeDoc = iframe[0].contentDocument || iframe[0].contentWindow.document; iframeDoc.open(); iframeDoc.write(code); iframeDoc.close(); }// Initial preview updatePreview(); }// Initialize on document ready and Elementor preview refresh $(document).on('ready code_editor_loaded', function() { $('.wp-code-editor-elementor').each(function() { if (!$(this).data('initialized')) { initCodeEditor($(this)); $(this).data('initialized', true); } }); });// For Elementor editor compatibility if (typeof elementor !== 'undefined') { elementor.hooks.addAction('panel/open_editor/widget', function() { setTimeout(function() { $('.wp-code-editor-elementor').each(function() { if (!$(this).data('initialized')) { initCodeEditor($(this)); $(this).data('initialized', true); } }); }, 300); }); } })(jQuery);